[jboss-user] [Installation, Configuration & DEPLOYMENT] - EJB3 deployment:Newbie question
JGF1
do-not-reply at jboss.com
Wed Mar 5 13:17:59 EST 2008
Hi folks.
I am in process of reading Beginning Java EE 5 Platform by Apress and can't seem to get my application to run. I was wondering if anyone can shed some light for me. It appears to be some sort of binding issue.
Directory Structure is:
SimpleSessionApp
beans
client
Code was compiled and run from SimpleSessionApp folder.
Here's the same code
| package beans;
|
| import javax.ejb.Remote;
|
| @Remote
| public interface SimpleSession
| {
| public String getEchoString(String clientString);
| }
|
| package beans;
|
| import javax.ejb.Stateless;
|
| @Stateless
| public class SimpleSessionBean implements SimpleSession {
| public String getEchoString(String clientString) {
| return clientString + " - from session bean";
| }
| }
|
| package client;
|
| import beans.SimpleSession;
| import javax.naming.InitialContext;
|
| public class SimpleSessionClient {
| public static void main(String[] args) throws Exception
| {
| InitialContext ctx = new InitialContext();
| SimpleSession simpleSession
| = (SimpleSession) ctx.lookup(SimpleSession.class.getName());
| for (int i = 0; i < args.length; i++) {
| String returnedString = simpleSession.getEchoString(args);
| System.out.println("sent string: " + args +
| ", received string: " + returnedString);
| }
| }
| }
|
I've had to set up complicated classpath:
c:\apps\jboss-4.2.2.ga\lib\concurrent.jar;
c:\apps\jboss-4.2.2.ga\lib\jboss-common-jar;
c:\apps\jboss-4.2.2.ga\client\jboss-j2ee.jar;
c:\apps\jboss-4.2.2.ga\lib\commons-httpclient.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-remoting.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-transaction.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jnpserver.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\ejb3.deployer\jboss-ejb3.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-ejb3x.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\jboss-aop-jdk50.deployer\jboss-aop-jdk50.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\jboss-aop-jdk50.deployer\jboss-aspect-library-jdk50.jar;
c:\apps\jboss-4.2.2.ga\client\jboss-common-client.jar;
The last one was omitted from book, and had been giving a ClassNotFound exception for Logger. Found this on the net in another forum.
But now, when I try and invoke program as follows:
java -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces -Djava.naming.provider.url=localhost client.SimpleSessionClient Now is the time for all good men
I get the following error:
Exception in thread "main" javax.naming.NameNotFoundException: beans.SimpleSession not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
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:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
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:667)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at client.SimpleSessionClient.main(SimpleSessionClient.java:10)
It's saying SimpleSession in package beans is not found.
Is this some sort of JNDI lookup problem?
Package was created as follows:
jar cf SimpleSessionApp.ejb3 beans\*.java
Copied SimpleSessionApp.ejb3 to server\all\deploy folder
Any ideas?
Cheers
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134368#4134368
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134368
More information about the jboss-user
mailing list