|
|
Tomcat starts up without error, but getting 404 error when doing remote calls
mons.dbcp.BasicDataSourcequot; destroy-method=quot;closequot; id=quot;dataSourcequot;gt; lt;property name=quot;driverClassNamequot; value=quot;${database.driverClassName}quot;/gt; lt;property name=quot;uclquot; value=quot;${database.ucl}quot;/gt; lt;property name=quot;usernamequot; value=quot;${database.username}quot;/gt; lt;property name=quot;passwordquot; value=quot;${database.password}quot;/gt; lt;property name=quot;validationQueryquot; value=quot;SELECT 1 FROM DUALquot;/gt; lt;property name=quot;testOnBorrowquot; value=quot;truequot;/gt; lt;/beangt; lt;bean class=quot;org..orm.jpa.JpaTransactionManagerquot; id=quot;transactionManagerquot;gt; lt;property name=quot;entityManagerFactoryquot; ref=quot;entityManagerFactoryquot;/gt; lt;/beangt; lt;tx:annotation-driven mode=quot;aspectjquot; transaction-manager=quot;transactionManagerquot;/gt; lt;bean class=quot;org..orm.jpa.LocalContainerEntityManagerFactoryBeanquot; id=quot;entityManagerFactoryquot;gt; lt;property name=quot;dataSourcequot; ref=quot;dataSourcequot;/gt; lt;/beangt; lt;flex:message-broker/gt;
lt;/beansgt;
Console output:
Code:
14.02.2011 20:19:19 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Programme\Java\jdk1.6.0_23\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\ATI Technologies\ATI.ACE\Core-Static;C:\Programme\TortoiseSVN\bin;C:\Programme\Java\jdk1.6.0_23\bin;C:\\maven-2.2.1.RELEASE\bin;C:\Programme\QuickTime\QTSystem\
14.02.2011 20:19:19 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNUNG: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:Translation' did not find a matching property.
14.02.2011 20:19:19 org.apache.coyote.from11.from11Protocol init
INFO: Initializing Coyote from/1.1 on from-8080
14.02.2011 20:19:19 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1051 ms
14.02.2011 20:19:19 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
14.02.2011 20:19:19 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
14.02.2011 20:19:20 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'Spring MVC Dispatcher Servlet'
[BlazeDS]Endpoint 'my-amf' created with security: None
at ucl: translation/messagebroker/amf
[BlazeDS]Endpoint 'my-private-amf' created with security: None
at ucl: translation/messagebroker/amfprivate
[BlazeDS]Endpoint 'my-secure-amf' created with security: None
at ucl: translation/messagebroker/amfsecure
[BlazeDS]MessageBroker id: _messageBroker classLoader is: the MessageBroker's class loader and the context class loader (classLoader hashCode: 16022517 (parent hashCode: 28904249 (parent system))
14.02.2011 20:19:49 org.apache.coyote.from11.from11Protocol start
INFO: Starting Coyote from/1.1 on from-8080
14.02.2011 20:19:49 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
14.02.2011 20:19:49 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
14.02.2011 20:19:49 org.apache.catalina.startup.Catalina start
INFO: Server startup in 29425 ms
Any help would be greatly appreciated. I've tried pretty much everything that came to my mind and am really stuck right now
Thanks,
Nick
How are you setting up your RemotingDestination? Try turning up the logging level on org..flex.remoting.RemotingDestinat ionExporter to INFO to verify that the destination is getting created at startup.
Hi Jeremy,
To set up the RemotingDestination, I first added the following annotations to the Java class that hosts the Remoting functions:Code:
@Transactional
@Service(quot;TranslationServicequot;)
@RemotingDestination(channels={quot;my-amfquot;,quot;my-secure-amfquot;})
public class TranslationService {
[...]
}
As this did not work, I've removed it again and tried the following at the end of web-application-context.xml. However, both did not help to solve the problem.Code:
lt;bean class=quot;org.translation.service.TranslationServicequot; id=quot;TranslationServicequot; /gt;
lt;flex:remoting-destination ref=quot;TranslationServicequot; /gt;
I turned up the logging level for the class you described, but nothing has changed at the console output. Is the below the correct syntax to update logging?Code: lt;logginggt; lt;target class=quot;org..flex.remoting.RemotingDestinatquot; level=quot;Infoquot;gt; lt;filtersgt; lt;patterngt;ionExporterlt;/patterngt; lt;/filtersgt; lt;/targetgt; lt;/logginggt;
Thanks!
It just occurred to me that with the mixed Spring MVC setup you're using, you probably need to set the mapping order for Flex, so that it has a change to handle a given request before the normal Spring MVC @Controller handling:Code:
lt;flex:message-broker mapping-order=quot;1quot;/gt;
As for the logging, no, that looks like the BlazeDS logging config in services-config.xml. We use commons logging, so you'd either need to configure java.util logging or log4j depending on which implementation is being used.
If setting the mapping-order doesn't do the trick, could we have a look at the code on the client side that you're using to invoked the destination, and perhaps your services-config.xml as well?
mon.Version - Hibernate Commons Annotations 3.2.0.Final
2011-02-15 01:29:22,125 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.0.Final
2011-02-15 01:29:22,125 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
2011-02-15 01:29:22,125 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
2011-02-15 01:29:22,156 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
2011-02-15 01:29:22,296 [main] INFO org.hibernate.ejb.Version - Hibernate EntityManager 3.6.0.Final
2011-02-15 01:29:22,359 [main] INFO org.hibernate.ejb.Ejb3Configuration - Processing PersistenceUnitInfo [
name: persistenceUnit
...]
2011-02-15 01:29:22,718 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class:
[... a lot of Hibernate stuff ...]
2011-02-15 01:29:40,875 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - schema export complete
2011-02-15 01:29:41,156 [main] INFO org..flex.config.FlexConfigurationManager - Loading Flex services configuration from: ServletContext resource [/WEB-INF/flex/services-config.xml]
2011-02-15 01:29:41,375 [main] INFO org..flex.core.MessageBrokerFactoryBean - BlazeDS - Community Edition: 4.0.0.14931
[BlazeDS]Endpoint 'my-amf' created with security: None
at ucl: translation/messagebroker/amf
[BlazeDS]Endpoint 'my-secure-amf' created with security: None
at ucl: translation/messagebroker/amfsecure
2011-02-15 01:29:41,421 [main] INFO org..flex.core.MessageBrokerFactoryBean - MessageBroker with id '_messageBroker' is starting.
[BlazeDS]MessageBroker id: _messageBroker classLoader is: the MessageBroker's class loader and the context class loader (classLoader hashCode: 16022517 (parent hashCode: 16795905 (parent system))
2011-02-15 01:29:41,890 [main] INFO org..flex.core.io.HibernateConfigProcessor - Hibernate detected and AMF serialization support automatically installed successfully.
2011-02-15 01:29:41,890 [main] INFO org..flex.core.MessageBrokerFactoryBean - MessageBroker with id '_messageBroker' is ready (startup time: '469' ms)
2011-02-15 01:29:41,890 [main] INFO org..web.servlet.handler.SimpleuclHandlerMapping - Default mapping to handler '_messageBroker'
2011-02-15 01:29:41,921 [main] INFO org..flex.remoting.RemotingDestinationExporter - Created remoting destination with id 'translationService'
2011-02-15 01:29:41,921 [main] INFO org..flex.remoting.RemotingDestinationExporter - Remoting destination 'translationService' has been started started successfully.
2011-02-15 01:29:42,078 [main] INFO org..web.servlet.DispatcherServlet - FrameworkServlet 'Spring MVC Dispatcher Servlet': initialization completed in 21625 ms
15.02.2011 01:29:42 org.apache.coyote.from11.from11Protocol start
INFO: Starting Coyote from/1.1 on from-8080
15.02.2011 01:29:42 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
15.02.2011 01:29:42 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/47 config=null
15.02.2011 01:29:42 org.apache.catalina.startup.Catalina start
INFO: Server startup in 22419 ms
My services-config.xml looks like this:Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;services-configgt;
lt;servicesgt; lt;default-channelsgt; lt;channel ref=quot;my-amfquot;/gt; lt;/default-channelsgt; lt;/servicesgt;
lt;channelsgt; lt;channel-definition id=quot;my-amfquot; class=quot;mx.messaging.channels.AMFChannelquot;gt;lt;endpoint ucl=quot;translation/messagebroker/amfquot; class=quot;flex.messaging.endpoints.AMFEndpointquot;/gt;
lt;!-- lt;propertiesgt;
lt;polling-enabledgt;falselt;/polling-enabledgt;
lt;/propertiesgt; --gt; lt;/channel-definitiongt;
lt;channel-definition id=quot;my-secure-amfquot; class=quot;mx.messaging.channels.SecureAMFChannelquot;gt;lt;endpoint ucl=quot;translation/messagebroker/amfsecurequot; class=quot;flex.messaging.endpoints.SecureAMFEndpointquot;/gt;lt;propertiesgt; lt;add-no-cache-headersgt;falselt;/add-no-cache-headersgt;lt;/propertiesgt; lt;/channel-definitiongt; lt;/channelsgt; lt;logginggt; lt;target class=quot;flex.messaging.log.ConsoleTargetquot; level=quot;Debugquot;gt;lt;propertiesgt; lt;prefixgt;[BlazeDS] lt;/prefixgt; lt;includeDategt;falselt;/includeDategt; lt;includeTimegt;falselt;/includeTimegt; lt;includeLevelgt;falselt;/includeLevelgt; lt;includeCategorygt;falselt;/includeCategorygt;lt;/propertiesgt;lt;filtersgt; lt;patterngt;Endpoint.*lt;/patterngt; lt;patterngt;Service.*lt;/patterngt; lt;patterngt;Configurationlt;/patterngt;lt;/filtersgt; lt;/targetgt; lt;/logginggt; lt;systemgt; lt;redeploygt;lt;enabledgt;falselt;/enabledgt; lt;/redeploygt; lt;/systemgt;
lt;/services-configgt;
The code on the client side is just for testing purposes right now, so pretty basic:Code:
lt;?xml version=quot;1.0quot; encoding=quot;utf-8quot;?gt;
lt;s:Application xmlns:fx=quot;mxml/2009quot; xmlns:s=quot;library--ns.adobe.com/flex/sparkquot; xmlns:mx=quot;library--ns.adobe.com/flex/mxquot; minWidth=quot;955quot; minHeight=quot;600quot;gt;
lt;fx eclarationsgt;
lt;s:RemoteObject id=quot;roquot; destination=quot;translationServicequot; endpoint=quot;translation/messagebroker/amfquot; /gt;
lt;/fx eclarationsgt;
lt;s:TextArea text=quot;{ro.test()}quot;/gt;
lt;/s:Applicationgt;
The test() method just returns a string with some text in it.
Oh, and this is what the Debug Flash Player returns as soon as I open the generated swf file:Code:
[RPC Fault faultString=quot;Send failedquot; faultCode=quot;Client.Error.MessageSendquot; faultDetail=quot;Channel.Connect.Failed error NetConnection.Call.Failed: from: Status 404: ucl: 'translation/messagebroker/amf'quot;]
at mx.rpc::AbstractInvoker/2006/flex/mx/internal::faultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:345]
at mx.rpc::Responder/fault()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:68]
at mx.rpc::AsyncRequest/fault()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:113]
at mx.messaging::ChannelSet/faultPendingSends()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:1614]
at mx.messaging::ChannelSet/channelFaultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:1206]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.messaging::Channel/connectFailed()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\Channel.as:1128]
at mx.messaging.channels: ollingChannel/connectFailed()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\PollingChannel.as:406]
at mx.messaging.channels::AMFChannel/statusHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\AMFChannel.as:453]/flex/sparkquot; xmlns:mx=quot;library--ns.adobe.com/flex/mxquot; minWidth=quot;955quot; minHeight=quot;600quot; applicationComplete=quot;init()quot;gt;
lt;fx:Scriptgt;
lt;![CDATA[
private function init():void {
ro.test();
}
]]gt;
lt;/fx:Scriptgt;
lt;fx eclarationsgt;
lt;s:RemoteObject id=quot;roquot; destination=quot;translationServicequot; endpoint=quot;translation/messagebroker/amfquot; /gt;
lt;/fx eclarationsgt;
lt;s:TextArea text=quot;{ro.test.lastResult}quot;/gt;
lt;/s:Applicationgt;
I'm sure I'm lacking some simple piece of information that would help me pin down your problem. Can you attach a .zip of your project?
Oh, thanks for that! I didn't do any Flex programming in a while - looks like I need to get back into the topic again
I'm sure you're right. It seems to me like I'm almost there, but some little piece might be wrong or missing, but I just don't see it. However, I don't really want to post my whole project publicly here in the forum, and it's bigger than the allowed file size anyway. Is there another way to get it over to you? I can easily upload it to my server and drop you a link if that helps.
Thanks for all your help so far, I really appreciate that! |
|