I am using the apress 'Beginning
Java EE, from Novice to Professional' book. In its first
EJB example it attempts to create am extremely simple stateless session bean. I am using
jboss application server 4.2.2 and java Runtime Environment, Standard Edition 1.5.0. There are two classes and a remote interface as follows;
The directory structure is;
SimpleSessionApp
|-beans
|-SimpleSession
|-SimpleSessionBean
|-client
|-SimpleSessionClient
The tells you to add the following to your classpath;
set CLASSPATH=.;C:\jboss\lib\concurrent.jar;
C:\jboss\lib\jboss-common.jar;
c:\jboss\client\jboss-j2ee.jar;
c:\jboss\lib\commons-httpclient.jar;
C:\jboss\server\all\lib\jboss.jar;
C:\jboss\server\all\lib\jboss-remoting.jar;
C:\jboss\server\all\lib\jboss-transaction.jar;
C:\jboss\server\all\lib\jnpserver.jar;
C:\jboss\server\all\deploy\ejb3.deployer\jboss-ejb3.jar;
C:\jboss\server\all\deploy\ejb3.deployer\jboss-ejb3x.jar;
C:\jboss\server\all\deploy\jboss-aop.deployer\
jboss-aop.jar;
C:\jboss\server\all\deploy\jboss-aop.deployer\
jboss-aspect-library.jar
The next step is to compile the java source code;
javac -d . client/*.java
javac -d . beans/*.java
After this you create an ejb3 jar;
jar cf SimpleSessionApp.ejb3 beans\*.java
And deploy this jar to your jboss deploy directory while jboss is running. Once this is done you run the client with the following arguments and switches while inside the client directory of SimpleSessionApp;
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
After having done all of this I get the following error
Exception in
thread "main" java.lang.NoSuchMethodError: main
why is this? This is my first attempt at creating an ejb and I'm totally lost. Any help would be appreciated.
Edited by: Jazman on Feb 19, 2008 2:42 PM