Tomcat 7 WEB-INF/classes not being loaded
843789Jul 29 2010 — edited Jul 30 2010Hi,
I have recently moved a web application from Adobe's ColdFusion server to Railo (open-source CFML engine) running on Tomcat. I've integrated BlazeDS and ActiveMQ with my Tomcat install so that I can push messages from Tomcat/BlazeDS to our front-end clients. In order to do so, I wrote a ServiceAdapter class to push messages to the clients.
The application utilizes a standard Tomcat "install" (i.e., I have a directory with all the Tomcat goodies at /Developer/tomcat). In my conf/server.xml file, I set up a host (dev.mysite.com) with a context path that points to another location on my system:
<Host name="dev.mysite.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/Users/my.user/my.sites/domain.com" />
</Host>
Because this app uses Flex remoting, I have a messaging-config.xml file in my WEB-INF/flex directory. The relevant part of this file is as follows:
The messaging adapter:
<adapter-definition id="duplicateLogonAdapter" class="com.gateways.adapters.duplicatelogon.DuplicateLogonServiceAdapter"/>
The destination:
<destination id="DuplicateLogonGateway">
<adapter ref="duplicateLogonAdapter" />
<properties>
<server>
<max-cache-size>1000</max-cache-size>
<durable>false</durable>
<allow-subtopics>true</allow-subtopics>
<subtopic-separator>.</subtopic-separator>
</server>
</properties>
<channels>
<channel ref="my-streaming-amf"/>
<channel ref="cf-polling-amf"/>
</channels>
</destination>
Where "com.gateways.adapters.duplicatelogon.DuplicateLogonServiceAdapter" is located in WEB-INF/classes/com/etc.
When I start Tomcat, I get the following error in catalina.out:
**** MessageBrokerServlet failed to initialize due to runtime exception: flex.messaging.MessageException: Cannot create class of type 'com.gateways.adapters.duplicatelogon.DuplicateLogonServiceAdapter'. Type 'com.kronum.gateways.adapters.duplicatelogon.DuplicateLogonServiceAdapter' not found. (^full stack trace below)
Tomcat's inability (b/c it's my fault :) to load this class causes the MessageBroker not to load.
If I remove the <destination> element from the messaging-config.xml, all starts up well and no errors (I can leave the adapter element in and no errors occur on startup).
Tomcat knows where all the Flex jars are (I specify the paths to those in catalina.properties in the common.loader line). However, those jars are in my ${catalina.home}/lib directory and not in my web application's WEB-INF/lib.
Not sure if that matters but thought I'd mention it.
I'm just not sure why Tomcat would not see the .class in WEB-INF/classes. I feel like I'm missing something so obvious but am pretty new to Tomcat and Java.
I am certain I've screwed up something but I'm stumped as to what I've got wrong.
Thanks in advance for any advice and assistance.
Best Regards,
Craig
^**** MessageBrokerServlet failed to initialize due to runtime exception: flex.messaging.MessageException: Cannot create class of type 'com.gateways.adapters.duplicatelogon.DuplicateLogonServiceAdapter'. Type 'com.gateways.adapters.duplicatelogon.DuplicateLogonServiceAdapter' not found.
at flex.messaging.util.ClassUtil.createClass(ClassUtil.java:65)
at flex.messaging.Destination.createAdapter(Destination.java:336)
at flex.messaging.config.MessagingConfiguration.createAdapter(MessagingConfiguration.java:359)
at flex.messaging.config.MessagingConfiguration.createDestination(MessagingConfiguration.java:351)
at flex.messaging.config.MessagingConfiguration.createServices(MessagingConfiguration.java:319)
at flex.messaging.config.MessagingConfiguration.configureBroker(MessagingConfiguration.java:99)
at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:125)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1164)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1118)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1005)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4529)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4800)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:138)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:990)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:772)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:138)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:990)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:275)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:138)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:424)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:138)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:648)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:138)
at org.apache.catalina.startup.Catalina.start(Catalina.java:576)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Edited by: craig.kaminsky on Jul 29, 2010 5:30 PM