JBoss 5.0.0.CR2, JBossWS Native (latest distribution). I've got a stateless session bean that I want to use as a web service endpoint. I created an Eclipse project using the (very handy!) ant tasks provided by the JBossWS Native distribution. I created my @Stateless-annotated implementation class, and specified (using @Remote) the remote interface for the class.
Using ant build file generated by the JBossWS ant tasks, I was able to build and deploy my jar file, although, both at app server startup and deployment time, I receive the following error:
/usr/local/jboss-5.0.0.CR2/server/logos/deploy/jbossws-container-jboss-beans.xml -> java.lang.IllegalStateException: WSKernelLocator is already installed.
The web service appears in the list of deployed services in the jbossws console, but I thought for my first test I would simply try to invoke the service as an EJB (through the Remote interface). The JNDI lookup succeeds (it finds an object with the proper JNDI name), but when I try to cast it to the EJB's Remote Interface, I get a ClassCastException. When I print out the actual type of the object returned from the JNDI lookup, I find that it is an instance of javax.naming.Reference.
So my questions are:
(1) Does anyone know what the startup / deployment error means?
(2) Why can't I seem to get a reference to my RemoteInterface via a JNDI lookup? (Why the ClassCastException?)
Sorry for being so long-winded, I just wanted to include anything that might help. Any advice would be very much appreciated!
1) There should be only one WSKernelLocatpor bean declared, and it should be in the jbossws-container-jboss-beans.xml file. It would appear that you have this bean also declared elsewhere. The best thing to to is a grep or text find to locate the extra declaration.
2) What JNDI name did you use? Have you used JNDIView to determine under what name the EJB was registered? http://www.jboss.org/community/docs/DOC-9583
1) You were right; there is an extra WSKernalLocator. There is one defined in the deployers/jbossws.deployer/META-INF/jbossws-container-jboss-beans.xml file, and another in the deploy/jbossws-container-jboss-beans.xml file (so one under the deployers directory, and another in the deploy directory). Which is the "correct" one to use?
2) For the JNDI name, I used "ProcessAdminEJB/remote"...The JNDI view from the JMXConsole shows the following:
+- ProcessAdminEJB (class: org.jnp.interfaces.NamingContext) | +- remote-werner.opt.process.admin.ProcessAdminRemote (class: Proxy for: werner.opt.process.admin.ProcessAdminRemote) | +- remote (class: Proxy for: werner.opt.process.admin.ProcessAdminRemote)
Is this correct?
Thanks for your help!
I removed the duplicate jbossws-container-jboss-beans.xml from the deploy directory of my server and the "WSKernelLocator already installed" error went away, but I am still getting the ClassCastException when I do a JNDI lookup on my EJB. I really have no idea what I'm doing wrong...everything seems to deploy without issue. If anyone has any suggestions, I would be most appreciative!
Yes, that's correct; sorry, I should have mentioned that I posted to the EJB3 forum. Once the WSKernelLocator issue was resolved by the removal of one of the duplicate files, I tried removing the web service annotations from my EJB, making it just a simple stateless session bean, to see if I could then do a JNDI lookup. I'm still getting a ClassCastException, though. I left the topic open in this forum, though, just in case anyone knew of any EJB-related problems from projects created using the ant tasks provided with the JBossWS Native distribution.