You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by nemesis_sun <ne...@yahoo.com> on 2012/06/24 04:50:07 UTC

Class Not Found exception

Hi all,

I've been coding Java EE for a while with NetBeans and Glassfish, but I'm
learning Geronimo as well. I have created a sample application and there was
a ClassNotFound exception when I tried to publish it to Geronimo in Eclipse.

This is an enterprise application EAR, containing 2 module, one for EJB and
the other is an App Client to read user's input and call the EJB for
inserting info into the database. The EJB module has a remote interface
(denoted with @Remote), an implementation EJB (denoted with @Stateless) and
an entity class (with @Entity). The EJB class has an
@PersistenceContext(unitName="...") to get an EntityManager to work with DB.
I have created DB/DS and configured the persistence.xml file according to
Geronimo tutorial.

When I published the EAR, there was this exception:

-------------------------------------------------------------------------------------------------------------
Distribution of module failed.  See log for details.
AppClientModuleBuilder: Could not load main class: Main
org.apache.geronimo.common.DeploymentException: AppClientModuleBuilder:
Could not load main class: Main
	at
org.apache.geronimo.client.builder.AppClientModuleBuilder.createAppClientClassFinder(AppClientModuleBuilder.java:807)
	at
org.apache.geronimo.client.builder.AppClientModuleBuilder.addGBeans(AppClientModuleBuilder.java:689)
	at
org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:652)
	at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:257)
	at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:136)
	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
org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
	at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:130)
	at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:851)
	at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:237)
	at org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
	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
org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
	at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:130)
	at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:851)
	at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:237)
	at
org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
	at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
	at
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427)
	at
javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
	at
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265)
	at java.security.AccessController.doPrivileged(Native Method)
	at
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1367)
	at
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)
	at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
	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)
Caused by: java.lang.ClassNotFoundException: Main in classloader
HRManager/Client/1.0/car
	at
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:407)
	at
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:257)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at
org.apache.geronimo.client.builder.AppClientModuleBuilder.createAppClientClassFinder(AppClientModuleBuilder.java:804)
	... 43 more
----------------------------------------------------------------------------------------------------------------

There was something wrong with the Main (containing main()) class, the only
class in the App Client module which works with the EJB module.

When I worked with NetBeans & Glassfish before, I rarely needed to touch the
deployment descriptor (those xml files) but mostly used annotation. I think
there is something wrong the the descriptors here, the 3 files from Java EE,
and 3 additional ones from Geronimo.

Can anyone help me diagnose where this error comes from? I'm willing to
provide more info on the application if you need.

Thanks.

--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/Class-Not-Found-exception-tp3985240.html
Sent from the Users mailing list archive at Nabble.com.