users@glassfish.java.net

Re: Fwd: Cannot use embedded container for unit tests

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Thu, 25 Feb 2010 17:29:09 -0800

Birol Yildiz wrote:
> On Thu, Feb 25, 2010 at 9:58 PM, Marina Vatkina <Marina.Vatkina_at_sun.com
> <mailto:Marina.Vatkina_at_sun.com>> wrote:
>
> As you can see, the problem starts with:
>
>
>
> > WARNUNG: Error in annotation processing:
> java.lang.NoClassDefFoundError:
> > build/classes/com/sample/crud/CrudService (wrong name:
> > com/sample/crud/CrudService)
>
> Looks like build/classes are not part of your classpath.
>
> Netbeans automatically includes these locations to the classpath. But
> even if do it manually, I get the same error message.

build/classes/com/sample/crud/CrudService seems like a class with a wrong
package name.

> Glassfish v3 seems to be not quiet ready. I also cannot deploy an
> ejb-jar if it contains external libraries.

Are you talking about embedded support?

If you are using EJB 3.1 embeddable API, your classpath must include all
relevant classes, and access more than 1 EJB module, but there is no support for
an ear deployment (the spec doesn't cover it).

  I have to include it into an
> ear to successfully deploy it. I'm trying to migrate a project from
> Glassfish v2.1 to Glassfish v3.

That is not an embedded case, right? There is no embedded support in Glassfish
v2.1. So if you have issues with migration, I suggest to start a separate thread.

thanks,
-marina

>
> Regards
>
>
> Regards,
> -marina
>
> Birol Yildiz wrote:
>
> The whole exception trace:
>
> 25.02.2010 19:57:54
> com.sun.enterprise.v3.server.AppServerStartup run
> INFO: GlassFish v3 (74.2) startup time : Embedded(1659ms)
> startup services(834ms) total(2493ms)
> 25.02.2010 19:57:54
> org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread
> run
> INFO: JMXStartupService: JMXConnector system is disabled, skipping.
> 25.02.2010 19:57:54
> com.sun.enterprise.transaction.JavaEETransactionManagerSimplified
> initDelegates
> INFO: Using
> com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate
> as the delegate
> 25.02.2010 19:57:55 AppServerStartup run
> INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
> 25.02.2010 19:58:08
> com.sun.enterprise.deployment.archivist.Archivist readAnnotations
> WARNUNG: Error in annotation processing:
> java.lang.NoClassDefFoundError:
> build/classes/com/sample/crud/CrudService (wrong name:
> com/sample/crud/CrudService)
> 25.02.2010 19:58:08 org.glassfish.api.ActionReport failure
> SCHWERWIEGEND: Exception while deploying the app
> java.lang.IllegalArgumentException: Invalid ejb jar
> [NotificationService-ejb.jar]: it contains zero ejb. Note: 1. A
> valid ejb jar requires at least one session, entity (1.x/2.x
> style), or message-driven bean. 2. EJB3+ entity beans (@Entity)
> are POJOs and please package them as library jar. 3. If the jar
> file contains valid EJBs which are annotated with EJB component
> level annotations (@Stateless, @Stateful, @MessageDriven,
> @Singleton), please check server.log to see whether the
> annotations were processed properly.
> at
> com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:72)
> at
> com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:124)
> at
> com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:722)
> at
> com.sun.enterprise.deployment.Application.visit(Application.java:1744)
> at
> com.sun.enterprise.deployment.archivist.ApplicationArchivist.validate(ApplicationArchivist.java:774)
> at
> com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:253)
> at
> com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:222)
> at
> org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:145)
> at
> org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:78)
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:612)
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:554)
> at
> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:262)
> at
> org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:214)
> at
> org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:144)
> at
> org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:128)
> at
> org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
> at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
> at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
> at
> com.test.location.GeoCoderServiceTest.setUpClass(GeoCoderServiceTest.java:30)
> 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> at
> junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:515)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1031)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:888)
> 25.02.2010 19:58:08
> org.glassfish.ejb.embedded.EJBContainerProviderImpl
> createEJBContainer
> INFO: [EJBContainerProviderImpl] Cleaning up on failure ...
> 25.02.2010 19:58:08
> org.glassfish.admin.mbeanserver.JMXStartupService shutdown
> INFO: JMXStartupService and JMXConnectors have been shut down.
> 25.02.2010 19:58:08
> com.sun.enterprise.v3.server.AppServerStartup stop
> INFO: Shutdown procedure finished
> 25.02.2010 19:58:08 AppServerStartup run
> INFO: [Thread[GlassFish Kernel Main Thread,5,main]] exiting
> 25.02.2010 19:58:08
> org.glassfish.ejb.embedded.EJBContainerProviderImpl
> createEJBContainer
> SCHWERWIEGEND: ejb.embedded.exception_instantiating
> javax.ejb.EJBException: Failed to deploy EJB modules - see log
> for details
> at
> org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:135)
> at
> org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
> at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
> at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
> at
> com.test.location.GeoCoderServiceTest.setUpClass(GeoCoderServiceTest.java:30)
> 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> at
> junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:515)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1031)
> at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:888)
> The following providers:
> org.glassfish.ejb.embedded.EJBContainerProviderImpl
> Returned null from createEJBContainer call.
> )
>
> My ejb-jar contains several EJBs, although the log says it
> contains zero.
>
> Thanks,
> Birol
>
>
> On Thu, Feb 25, 2010 at 6:56 PM, Marina Vatkina
> <Marina.Vatkina_at_sun.com <mailto:Marina.Vatkina_at_sun.com>
> <mailto:Marina.Vatkina_at_sun.com <mailto:Marina.Vatkina_at_sun.com>>>
> wrote:
>
> What are the messages before this exception?
>
> thanks,
> -marina
>
>
> Birol Yildiz wrote:
>
> Hi,
>
> I'm trying to use the the embedded ejb container for unit
> testing. I'm getting the following message (stack trace
> below):
>
> The following providers:
> org.glassfish.ejb.embedded.EJBContainerProviderImpl
> Returned null from createEJBContainer call.
>
> I'm using NetBeans 6.8 and GlassFish v3 (build 74.2). The
> glassfish-embedded-static-shell.jar is included in the test
> libraries (NetBeans did this automatically). I also tried
> using
> glassfish-embedded-all-3.01-b02.jar.
>
>
> STACK TRACE
> ----------------------
> javax.ejb.EJBException: Failed to deploy EJB modules -
> see log
> for details
> at
>
> org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:135)
> at
>
> org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
> at
>
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
> at
>
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
> at
>
> com.bypa.notificationservice.location.GeoCoderServiceTest.setUpClass(GeoCoderServiceTest.java:30)
> 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at
>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> at
>
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> at
> org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> at
>
> junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
> at
>
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:515)
> at
>
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1031)
> at
>
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:888)
> The following providers:
> org.glassfish.ejb.embedded.EJBContainerProviderImpl
> Returned null from createEJBContainer call.
> )
>
> Regards,
> Birol
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe_at_glassfish.dev.java.net
> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
> <mailto:users-unsubscribe_at_glassfish.dev.java.net
> <mailto:users-unsubscribe_at_glassfish.dev.java.net>>
>
> For additional commands, e-mail:
> users-help_at_glassfish.dev.java.net
> <mailto:users-help_at_glassfish.dev.java.net>
> <mailto:users-help_at_glassfish.dev.java.net
> <mailto:users-help_at_glassfish.dev.java.net>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> <mailto:users-help_at_glassfish.dev.java.net>
>
>