Link to home
Create AccountLog in
Avatar of funaki01
funaki01

asked on

Flex 3 error "Destination either does not exist or the destination has no channels defined"

I have been battling with this problem for the last few days so could really do with some help :)
I have a Flex3 app using Blazeds to recieve messages being pushed from a Web App on a Tomcat server - the app on the server is working fine and can see things working as I expect. I consistently get the error message "The Destination ["alarm-event-feed"]either does not exist or the destination has no channels defined" when I try to run the Flex3 app.
I've attached the config files from the Tomcat server - can anyone help??


services-config.doc
remoting-config.doc
proxy-config.doc
messaging-config.doc
Avatar of julianopolito
julianopolito
Flag of Brazil image

please can you send those files again, but in plain text? I'm having trouble opening the doc files in office 2007, it won't let me see the pure xml.
Avatar of funaki01
funaki01

ASKER

Will have to wait until I'm back in the office tomorrow morning, but will do first thing.
Or I could use my brain and OpenOffice to get the text for you :| Sorry been a long day..... see below :
services-config.xml :
 
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
 
    <services>
        <service-include file-path="remoting-config.xml" />
        <service-include file-path="proxy-config.xml" />
        <service-include file-path="messaging-config.xml" />        
    </services>
 
    <security>
        <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
        <!-- Uncomment the correct app server
        <login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss">
		<login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>        
        <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
        <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
        -->
 
        <!-- 
        <security-constraint id="basic-read-access">
            <auth-method>Basic</auth-method>
            <roles>
                <role>guests</role>
                <role>accountants</role>
                <role>employees</role>
                <role>managers</role>
            </roles>
        </security-constraint>
         -->
    </security>
 
    <channels>
        <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint"/>
        </channel-definition>
        
        <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>
 
        <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
            <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
            <properties>
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>
 
        <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>true</polling-enabled>
                <polling-interval-seconds>4</polling-interval-seconds>
            </properties>
        </channel-definition>
 
        <!--
        <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
        </channel-definition>
 
        <channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
            <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
            <properties>
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>
        -->
    </channels>
 
    <logging>
        <target class="flex.messaging.log.ConsoleTarget" level="Error">
            <properties>
                <prefix>[BlazeDS] </prefix>
                <includeDate>false</includeDate>
                <includeTime>false</includeTime>
                <includeLevel>false</includeLevel>
                <includeCategory>false</includeCategory>
            </properties>
            <filters>
                <pattern>Endpoint.*</pattern>
                <pattern>Service.*</pattern>
                <pattern>Configuration</pattern>
            </filters>
        </target>
    </logging>
 
    <system>
        <redeploy>
            <enabled>false</enabled>
            <!-- 
            <watch-interval>20</watch-interval>
            <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file>
            <touch-file>{context.root}/WEB-INF/web.xml</touch-file>
             -->
        </redeploy>
    </system>
 
</services-config>
 
messaging-config.xml :
 
<?xml version="1.0" encoding="UTF-8"?>
<service id="message-service" 
    class="flex.messaging.services.MessageService">
 
    <adapters>
        <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" />
        <!-- <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/> -->
    </adapters>
 
    <default-channels>
        <channel ref="my-polling-amf"/>
    </default-channels>
    
    <destination id="alarm-event-feed">
        <properties>
            <server>
                <allow-subtopics>true</allow-subtopics>
                <subtopic-separator>.</subtopic-separator>s
            </server>
        </properties>
        <channels>
			<channel ref="my-polling-amf"/>
        </channels>        
    </destination>
 
</service>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of julianopolito
julianopolito
Flag of Brazil image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I was taking a second look at the reference documentation and there seem to be a little difference between your tag and the docs:

Here you wrote class= and AMFEndpoint. In the reference it is type= and AmfEndpoint . Could it be the error? According to the docs it should look like this:

<channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" type="flex.messaging.endpoints.AmfEndpoint"/>
            <properties>
                <polling-enabled>true</polling-enabled>
                <polling-interval-seconds>4</polling-interval-seconds>
            </properties>
        </channel-definition>

Here is the docs I was looking. As I can't test it now and don't have flex in this machine I'm in, I went for the docs, cause i can't remember those details:

http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001099.html


No that doesn't seem to work - I now get the following error on Tomcat starting

javax.servlet.UnavailableException: Unexpected attribute 'type' found in 'endpoint' from file: services-config.xml.
Okay here is some of the code from the client Flex 3 app and from the server side code which is sending out the message :

I'm getting a "Exception in thread "Thread-2" java.lang.NullPointerException" error now on the  msgBroker.routeMessageToService(msg, null); line - no Service to send to I presume??
client code :		        
                        private function initApp():void
			{
				consumers = new Object();
				eventList = new Object();
				items = new ArrayCollection();
				subscribe();
			}
						
			
			private function subscribe():void
			{
				var consumer:Consumer = new Consumer();
				consumer.channelSet = ServerConfig.getChannelSet("alarm-event-feed");
				consumer.destination = "alarm-event-feed";
				consumer.addEventListener(MessageEvent.MESSAGE, messageHandler);
				consumer.subscribe();
			}
					
			
			private function messageHandler(event:MessageEvent):void 
			{
				var newAlarmEvent:AlarmEvent = event.message.body as AlarmEvent;
				if (newAlarmEvent)
				{
					items.addItem(newAlarmEvent);	
				}
	        }
			
server side code :
 
private void updateAlarmFeed(AlarmEvent alarmEvent) {
		MessageBroker msgBroker = MessageBroker.getMessageBroker(null);
		String clientID = UUIDUtils.createUUID();
		AsyncMessage msg = new AsyncMessage();
		msg.setDestination("alarm-event-feed");
		msg.setClientId(clientID);
		msg.setMessageId(UUIDUtils.createUUID());
		msg.setTimestamp(System.currentTimeMillis());
		msg.setBody(alarmEvent);
		msgBroker.routeMessageToService(msg, null);
	}

Open in new window

Have gone back to the original turnkey tomcat provided with BlazeDS and have been able to run my app successfully - had already looked at the docs for deploying BlazeDS onto your own tomcat installation but they were rather vague so I will now have to trawl through every setting to work out why it works on one and not the other :(
I'll accept julianopolito contribution as the solution and close this question and possibly pose another.
thank you funaki. I'm sorry i could not be more helpful. Anyway if you need something, just post.