| Author |
Simple EJB3 session beans not deploying in JBOSS6
|
Ravi Kumar Onteru
Greenhorn
Joined: Nov 10, 2009
Posts: 5
|
|
Hi,
I am newbie to EJB3 and started my first example with JBOSS6 installed in my machine.
I am able to run the server and When i deploy the ejb jar file into "%JBOSS_HOME%\server\default\deploy\" directory, it is not showing any message saying that the bean or the application has been deployed.
Also when i am trying to access the same with standalone client, it is throwing the following Exception...
i would appriciate any help in resolving this issue.
D:\EJB3Dev\simple-ejb\src>java -cp %JBOSS_HOME%\client\jbossall-client.jar;.\..\classes;. example.ClientEjb
about to lookup the JNDI name:java:comp/env/ejb/HelloWorldBean
log4j:WARN No appenders could be found for logger (org.jnp.interfaces.TimedSocketFactory).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" javax.naming.NameNotFoundException: comp not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at example.ClientEjb.main(ClientEjb.java:14)
Also here is my jndi.properties file in the "D:\EJB3Dev\simple-ejb\src" directory.
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming rg.jnp.interfaces
java.naming.provider.url=localhost:1099
Thanks & Regards,
Ravi
|
Ravi Kumar Onteru
SCJP1.4, SCWCD1.4
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8142
|
|
When i deploy the ejb jar file into "%JBOSS_HOME%\server\default\deploy\" directory, it is not showing any message saying that the bean or the application has been deployed.
What does that jar contain? Post the output of:
|
[My Blog] [JavaRanch Journal]
|
 |
Sunny Bhandari
Ranch Hand
Joined: Dec 06, 2010
Posts: 446
|
|
|
if you could post the code of EJB and the client...
|
 |
Ravi Kumar Onteru
Greenhorn
Joined: Nov 10, 2009
Posts: 5
|
|
Hi,
Here is the contents of the .jar file
C:\jboss-6.0.0\server\default\deploy>jar -tf HelloWorldEjb.jar
META-INF/
META-INF/MANIFEST.MF
../classes/example/HelloWorldInt.class
../classes/example/HelloWorldBean.class
And the Code is here
Business Interface:
Bean Class:
Standalone Client to access EJB
Regards,
Ravi
|
 |
Ravi Kumar Onteru
Greenhorn
Joined: Nov 10, 2009
Posts: 5
|
|
Hi,
Here is the client code i have tried.
Regards,
Ravi
|
 |
Ravi Kumar Onteru
Greenhorn
Joined: Nov 10, 2009
Posts: 5
|
|
Hi,
The contents of the JAR seems to be invalid. And thanks for pointing me to the contents of the jar. I have re-created the jar file that contains the following contents:
C:\jboss-6.0.0\server\default\deploy>jar -tf HelloWorldEjb.jar
META-INF/
META-INF/MANIFEST.MF
example/HelloWorldBean.class
example/HelloWorldInt.class
After this trail, the JBOSS6 server is responding with a message that it has considered the jar for deployment as follows:
HelloWorldBean/remote - EJB3.x Default Remote Business Interface
HelloWorldBean/remote-example.HelloWorldInt - EJB3.x Remote Business Interface
18:22:20,437 WARN [org.jboss.ejb3.TimerServiceContainer] EJBTHREE-2193: using deprecated TimerServiceFactory for restoring timers
But still, when i am trying to run the client code, it is throwing the following exception:
[color=darkred]D:\EJB3Dev\simple-ejb\classes>java -cp %JBOSS_HOME%\client\jbossall-client.jar;. example.ClientEjb
about to lookup the JNDI name:java:comp/env/ejb/HelloWorldBean
log4j:WARN No appenders could be found for logger (org.jnp.interfaces.TimedSocketFactory).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" javax.naming.NameNotFoundException: comp not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at example.ClientEjb.main(ClientEjb.java:14)[/color]
Please help in resolving the same.
Regards,
Ravi
|
 |
Ravi Kumar Onteru
Greenhorn
Joined: Nov 10, 2009
Posts: 5
|
|
Hi,
Thanks for all your focus on the problem. The problem is resolved now. There were two issues.
The first problem was that, the contents of the jar file was invalid. It has the top level directories also.
For jndi.properties, was not accessible in the classpath, some how.
Both of these problems have been resolved and my first bean started working.
Thanks & Regards,
Ravi
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8142
|
|
Glad to know you got it working!
|
 |
 |
|
|
subject: Simple EJB3 session beans not deploying in JBOSS6
|
|
|