[JBoss and NetBeans] - java.lang.NoClassDefFoundError: ${main/class} only on JBoss
by htran_888
Hi All,
I am encountering the following errors when running the Enterprise Application Client using JBoss 4.2.2 AS:
--------------------------------------------------------------------------------------
Deploying C:\Documents and Settings\abc\EnterpriseAppEE5-JBoss422\dist\EnterpriseAppEE5-JBoss422.ear
java.lang.NoClassDefFoundError: ${main/class}
Exception in thread "main" â when running application client for the first few times. This was followed by the error messages below:
C:\Documents and Settings\abc\EnterpriseAppEE5-JBoss422\nbproject\build-impl.xml:261:
The following error occurred while executing this line:
C:\Documents and Settings\abc\EnterpriseAppEE5-JBoss422\nbproject\build-impl.xml:282: Classname must not be null.
BUILD FAILED (total time: 1 second)
Exception in thread "main" java.lang.NullPointerException
at enterpriseappee5JBoss422.Main.main(Main.java:13)
Java Result: 1
run-EnterpriseAppEE5-JBoss422-app-client:
--------------------------------------------------------------------------------------
Below are the Enterprise Application property runs in Netbeans 6.0, jdk1.6.0_03, Windows XP, SP2:
EnterpriseAppEE5-JBoss422-ejb => Run => Main Class - enterpriseappee5jboss422.Main.
| EnterpriseAppEE5-JBoss422 = > Run => Client Module - EnterpriseAppEE5-JBoss422-app-client, Main Class â blank.
Codes for the stateless session bean (EnterpriseAppEE5-JBoss422-ejb) is:
package ejb;
| import javax.ejb.Remote;
|
| @Remote
| public interface SessionRemote {
|
| public String getResult();
|
| }
package ejb;
|
| import javax.ejb.Stateless;
|
| @Stateless
| public class SessionBean implements SessionRemote {
|
| public String getResult() {
| return "This is EJB 3.0 Bean";
| }
| }
Code for the application client (EnterpriseAppEE5-JBoss422-app-client) is:
package enterpriseappee5JBoss422x;
|
| import ejb.SessionRemote;
| import javax.ejb.EJB;
|
| public class Main {
|
| @EJB
| private static SessionRemote sessionBean;
|
| public static void main(String[] args) {
|
| System.err.println("result=" + sessionBean.getResult());
| }
| }
I have had no success after having tried adjusting the following settings in Netbeans Enterprise application properties:
EnterpriseAppEE5-JBoss422 = > Run => Client Module - EnterpriseAppEE5-JBoss422-app-client, Main Class â ejb.Main or enterpriseappee5JBoss422.Main.
There were no such issue when running the same codes in the same environment but with Glass Fish (v2) instead of JBoss 4.2.2 AS.
The URL for the above tutorial can be found in http://testwww.netbeans.org/kb/articles/appclient-entappclient.html.
I have tried to follow the suggestion from (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=126495) without success.
I am confused about the need to have a Main Class when there is already a Client class which can call the main method already. E.g. ConverterClient in J2EE EJB tutorial (http://docs.sun.com/app/docs/doc/819-3669/bnbnc?l=en&q=javaeetutorial5&a=...).
Thanks,
George
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115839#4115839
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115839
17 years
[JBoss jBPM] - jbpmContext.getSessionFactory().openSession() and jbpmConte
by rainhust
Session session = jbpmContext.getSessionFactory().openSession();
| Transaction tx = session.beginTransaction();
|
this's ok!
and i use following code , will get a "Transaction not successfully started" exception.
| Session session = jbpmContext.getSession();
| Transaction tx = session.beginTransaction();
|
i saw the source code, and in "org.jbpm.persistence.db.DbPersistenceService" class i found:
| public Session getSession() {
| if ( (session==null)
| && (getSessionFactory()!=null)
| ) {
| Connection connection = getConnection(false);
| if (isCurrentSessionEnabled) {
| session = getSessionFactory().getCurrentSession();
| log.debug("using current hibernate session " + session);
| mustSessionBeClosed = false;
| mustSessionBeFlushed = false;
| mustConnectionBeClosed = false;
| } else if (connection!=null) {
| log.debug("creating hibernate session with connection "+connection);
| session = getSessionFactory().openSession(connection);
| mustSessionBeClosed = true;
| mustSessionBeFlushed = true;
| mustConnectionBeClosed = false;
| } else {
| log.debug("creating hibernate session");
| session = getSessionFactory().openSession();
| mustSessionBeClosed = true;
| mustSessionBeFlushed = true;
| mustConnectionBeClosed = false;
| }
|
| if (isTransactionEnabled) {
| beginTransaction();
| }
| }
| return session;
| }
maybe "isTransactionEnabled" started a transaction,and this cause the exception.
so ,i want to know where "isTransactionEnabled" can config in jbpm config file.
also you can tell me jbpmContext.getSessionFactory().openSession() and jbpmContext.getSession() difference, and how to correct using them.
any advice, thx.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115833#4115833
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115833
17 years
[Management, JMX/JBoss] - Port used by jConsole connect remotely to JBoss AS behind fi
by gigsvoo
Hi there,
First of all, currently my JBoss AS sit inside a remote location Linux hosting server, exposing HTTP, HTTPS, 8080 and 11099 (jConsole usage) to allowed services for firewall. Then when I connect it with firewall turned off, I had actually found that despite connection via port TCP 11099, there is another port being used. So I also added that port into remote server firewall allowed services, then turned on the firewall service and everything works just fine.
Later when I restarted the JBoss AS for other reason, I found that the 2nd random port being used by JBoss AS besides 11099 has changed. How does that happening? Is there anyway to fix the 2nd additional port used by jConsole so everytime I restart AS, I don't have to change the firewall setting?
Thanks
David
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115832#4115832
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115832
17 years
[Installation, Configuration & DEPLOYMENT] - Re: help required please : problem with project packaging -
by wiggy
tried creating an EAR project and including the EJB project and the two util projects and deployed that
get essentially the same problem - somehow the EJB project cant see the util project its dependent upon (its still on the build path and the pakaage referenences lists though from the EJB project)
off to bed - if any one can help me past this problemo i'd be ever so greatful. I can't carry on building all the logic in one project it'll get ridiculous.
anonymous wrote :
| 01:27:17,589 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=NeilsAppEAOEJBProject.jar
| java.lang.NoClassDefFoundError: eao/EAO
| at java.lang.ClassLoader.defineClass1(Native Method)
| at java.lang.ClassLoader.defineClass(Unknown Source)
| at java.security.SecureClassLoader.defineClass(Unknown Source)
| at java.net.URLClassLoader.defineClass(Unknown Source)
| at java.net.URLClassLoader.access$000(Unknown Source)
| at java.net.URLClassLoader$1.run(Unknown Source)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.net.URLClassLoader.findClass(Unknown Source)
| at org.jboss.mx.loading.RepositoryClassLoader.findClassLocally(RepositoryClassLoader.java:682)
| at org.jboss.mx.loading.RepositoryClassLoader.findClass(RepositoryClassLoader.java:662)
| at java.lang.ClassLoader.loadClass(Unknown Source)
| at org.jboss.mx.loading.RepositoryClassLoader.loadClassLocally(RepositoryClassLoader.java:200)
| at org.jboss.mx.loading.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:131)
| at org.jboss.mx.loading.LoadMgr3.nextTask(LoadMgr3.java:399)
| at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:527)
| at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
| at java.lang.ClassLoader.loadClass(Unknown Source)
| at java.lang.ClassLoader.loadClassInternal(Unknown Source)
| at java.lang.ClassLoader.defineClass1(Native Method)
| at java.lang.ClassLoader.defineClass(Unknown Source)
| at java.security.SecureClassLoader.defineClass(Unknown Source)
| at java.net.URLClassLoader.defineClass(Unknown Source)
| at java.net.URLClassLoader.access$000(Unknown Source)
| at java.net.URLClassLoader$1.run(Unknown Source)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.net.URLClassLoader.findClass(Unknown Source)
| at org.jboss.mx.loading.RepositoryClassLoader.findClassLocally(RepositoryClassLoader.java:682)
| at org.jboss.mx.loading.RepositoryClassLoader.findClass(RepositoryClassLoader.java:662)
| at java.lang.ClassLoader.loadClass(Unknown Source)
| at org.jboss.mx.loading.RepositoryClassLoader.loadClassLocally(RepositoryClassLoader.java:200)
| at org.jboss.mx.loading.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:131)
| at org.jboss.mx.loading.LoadMgr3.nextTask(LoadMgr3.java:399)
| at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:527)
| at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
| at java.lang.ClassLoader.loadClass(Unknown Source)
| at org.jboss.ejb3.Ejb3AnnotationHandler.populateBaseInfo(Ejb3AnnotationHandler.java:293)
| at org.jboss.ejb3.Ejb3AnnotationHandler.getContainers(Ejb3AnnotationHandler.java:138)
| at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:486)
| at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:442)
| at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:423)
| at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:384)
| at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:327)
| at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:77)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
| at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy0.create(Unknown Source)
| at org.jboss.system.ServiceController.create(ServiceController.java:330)
| at org.jboss.system.ServiceController.create(ServiceController.java:273)
| at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy33.create(Unknown Source)
| at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:492)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
| at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
| at org.jboss.wsf.container.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:76)
| at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
| at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy34.create(Unknown Source)
| at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
| at org.jboss.deployment.MainDeployer.create(MainDeployer.java:959)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy9.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
| 01:27:17,609 INFO [EJB3Deployer] Deployed: file:/E:/jboss/jboss-4.2.2.GA/server/default/deploy/NeilsAppEar.ear/NeilsAppEAOEJBProject.jar/
| 01:27:17,769 INFO [EARDeployer] Started J2EE application: file:/E:/jboss/jboss-4.2.2.GA/server/default/deploy/NeilsAppEar.ear/
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115830#4115830
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115830
17 years
[Installation, Configuration & DEPLOYMENT] - help required please : problem with project packaging and pe
by wiggy
wonder if some one can help. Think is simple but cant see the wood from the trees. Any help greatefully received.
I'm in callisto eclipse /jboss 4.2.2 and I have a test app that i built as an ejb project (all in one) - and built all my entities, stateless session beans, generic EAO (variant of DAO pattern - from "ejb3 in action" book and a persistence unit.
I deploy to server and all is well and i can find the services and call them from external client app. So far so good.
I then come to refactor my project into manageable project chunks. I created two utility projects - one for the entities (no persistence unit defined here - just the marked up entity classes), then another utility project with the generic EAO code base.
I then create an EJB project to house the real EAO (extend the generic) for each entity class in the domain model utility project.
I set the java build path to include the two utility projects, and I also set the "project references" to include these also. (i cant set the j2ee depencies for the EJB project - it says "selected model not associated with an enterprise application module").
my top level EJB project has the persistence facet set and my persistence xml is defined here.
this all compiles without warning. so project dependency relationships set up as follows
eao ejb proj (inc persistence xml defn)
| |
v v
entity util proj generic eao util project
However : if i try to publish this refactored project eao EJB project to the server I then get an error on the server
anonymous wrote :
| 01:10:43,770 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
|
| --- MBeans waiting for other MBeans ---
| ObjectName: jboss.j2ee:service=EJB3,module=NeilsAppEAOEJBProject.jar
| State: FAILED
| Reason: java.lang.NoClassDefFoundError: eao/EAO
|
| --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
| ObjectName: jboss.j2ee:service=EJB3,module=NeilsAppEAOEJBProject.jar
| State: FAILED
| Reason: java.lang.NoClassDefFoundError: eao/EAO
|
what i think this says is that the class loader for the EJB project cant see the utility projects. Why is that ?
if I refactor like this do I have to package all the projects into an EAR? to get them to work ?
when you run multiple projects like this - where should the persistence unit be defined? - I have defined it with the EAO instance definitions (concrete classes) that prsist my entities - rather than in the utility projects - is that right ? or does the persistence unit definition live with the entities in the util project (this doesnt seem right).
so can some one help me understand why what works in on big EJB project doesnt work when i refactor into multiple projects.
This is going to be easy (i think) and i shall feel stupid later - but its driving me nuts at present
I am only using eclipse as the build tool at present - i have no ant/maven framework setup (requires more time to read about these) and i'd like to get the basics running from eclipse if i could first.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115829#4115829
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115829
17 years