java.lang.ClassCastException: org.jnp.interfaces.NamingConte
tamscot Nov 23, 2007 4:26 PMHi all,
help for a relative newbie required...
Having problems running a slight modification of an example from the book Eclipse Web Tools Platform.
Platform first...
Linux.
Eclipse 3.2 with J2EE
JDK 1.4.
EJB Module 2.1
EJB Doclet(XDoclet) 1.2.3.
When running a message driven EJB I get the following exception in the console ...
20:58:29,953 ERROR [STDERR] java.lang.ClassCastException: org.jnp.interfaces.NamingContext 20:58:29,955 ERROR [STDERR] at com.jujitsu.ejb.AsyncJujitsuFacadeUtil.getQueueConnection(AsyncJujitsuFacadeUtil.java:69) 20:58:29,955 ERROR [STDERR] at com.jujitsu.servlets.CreateClubAction.sendMessage(CreateClubAction.java:51) 20:58:29,955 ERROR [STDERR] at com.jujitsu.servlets.CreateClubAction.doGet(CreateClubAction.java:34) 20:58:29,955 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) 20:58:29,955 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) 20:58:29,955 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) 20:58:29,955 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 20:58:29,956 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 20:58:29,956 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) 20:58:29,956 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 20:58:29,956 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) 20:58:29,956 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) 20:58:29,956 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) 20:58:29,957 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) 20:58:29,957 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) 20:58:29,957 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) 20:58:29,957 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) 20:58:29,957 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) 20:58:29,957 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) 20:58:29,958 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) 20:58:29,958 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) 20:58:29,958 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) 20:58:29,958 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) 20:58:29,958 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
Now the exception occurs in the call to...
cachedConnectionFactory = (javax.jms.QueueConnectionFactory) objRef;
in the xdoclet generated class AsyncJujitsuFacadeUtil.
I added the destination-jndi-name to the jbossmq-destinations-service.xml file as so...
<mbean code="org.jboss.mq.server.jmx.Queue" name="jboss.mq.destination:service=Queue,name=AsyncJujitsuFacade">
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>
This looks to have been bound...
20:50:40,964 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
20:50:41,721 INFO [A] Bound to JNDI name: queue/A
20:50:41,725 INFO [B] Bound to JNDI name: queue/B
20:50:41,728 INFO [C] Bound to JNDI name: queue/C
20:50:41,731 INFO [D] Bound to JNDI name: queue/D
20:50:41,734 INFO [ex] Bound to JNDI name: queue/ex
20:50:41,736 INFO [AsynchLeagueFacade] Bound to JNDI name: queue/AsynchLeagueFacade
20:50:41,739 INFO [AsyncJujitsuFacade] Bound to JNDI name: queue/AsyncJujitsuFacade
20:50:41,823 INFO [testTopic] Bound to JNDI name: topic/testTopic
20:50:41,826 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
20:50:41,829 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
20:50:41,843 INFO [testQueue] Bound to JNDI name: queue/testQueue
20:50:42,023 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.0.0:8093
20:50:42,319 INFO [DLQ] Bound to JNDI name: queue/DLQ
20:50:42,890 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
20:50:43,066 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
20:50:43,541 INFO [EARDeployer] Init J2EE application: file:/home/tam/opt/jboss-4.0.5.GA/server/default/deploy/JujitsuEJBEAR.ear
20:50:44,265 INFO [EjbModule] Deploying JujitsuFacade
20:50:44,523 INFO [EjbModule] Deploying AsyncJujitsuFacade
20:50:45,005 INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'JujitsuFacade' to jndi 'JujitsuFacadeLocal'
20:50:45,057 INFO [ProxyFactory] Bound EJB Home 'JujitsuFacade' to jndi 'JujitsuFacade'
20:50:45,500 INFO [EJBDeployer] Deployed: file:/home/tam/opt/jboss-4.0.5.GA/server/default/tmp/deploy/tmp412JujitsuEJBEAR.ear-contents/JujitsuEJB.jar
20:50:45,750 INFO [TomcatDeployer] deploy, ctxPath=/jujitsuWeb, warUrl=.../tmp/deploy/tmp412JujitsuEJBEAR.ear-contents/jujitsuWeb-exp.war/
20:50:46,103 INFO [EARDeployer] Started J2EE application: file:/home/tam/opt/jboss-4.0.5.GA/server/default/deploy/JujitsuEJBEAR.ear
20:50:46,108 INFO [EARDeployer] Init J2EE application: file:/home/tam/opt/jboss-4.0.5.GA/server/default/deploy/LeaguePlanetEAR.ear
20:50:46,444 INFO [EjbModule] Deploying LeagueFacade
20:50:46,474 INFO [EjbModule] Deploying AsynchLeagueFacade
20:50:46,766 INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'LeagueFacade' to jndi 'LeagueFacadeLocal'
20:50:46,806 INFO [ProxyFactory] Bound EJB Home 'LeagueFacade' to jndi 'LeagueFacade'
20:50:46,860 INFO [EJBDeployer] Deployed: file:/home/tam/opt/jboss-4.0.5.GA/server/default/tmp/deploy/tmp414LeaguePlanetEAR.ear-contents/LeaguePlanetEJB.jar
20:50:46,964 INFO [TomcatDeployer] deploy, ctxPath=/LeaguePlanetWeb, warUrl=.../tmp/deploy/tmp414LeaguePlanetEAR.ear-contents/LeaguePlanetWeb-exp.war/
20:50:47,372 INFO [EARDeployer] Started J2EE application: file:/home/tam/opt/jboss-4.0.5.GA/server/default/deploy/LeaguePlanetEAR.ear
20:50:47,651 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
20:50:48,195 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
20:50:48,267 INFO [JkMain] Jk running ID=0 time=0/223 config=null
20:50:48,395 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)] Started in
Anyone any idea why this is happening and the actions needed to remedy the situation. When debugging I follow the trace which does not go as far as any code I have produced.
SIDE NOTE...I hate when running a program runs into an exception which is hard to dig out because you have not coded where the exception occurs. Not that would make any difference :)