Skip to main content

Junit Tests with GlassFish Problems

15 replies [Last post]
yahya_h
Offline
Joined: 2010-09-14

Hello,
i'm trying to write testcases for EJBs with netbeans ant and GF, i have tried every combination i have found in the net but i still get the same problem.
i have added all possible embedded Container and removed them but no success
i think i'm missing something. can anyone plz tel me what i'm doing wrong.

here are the errors:

15.09.2010 09:06:05 org.glassfish.ejb.embedded.EJBContainerProviderImpl getValidFile
SCHWERWIEGEND: ejb.embedded.location_not_exists
------------- ---------------- ---------------
Testcase: org.rle.ecenter.ws.eCenterServiceTest: Caused an ERROR
No EJBContainer provider available
Provider named org.glassfish.ejb.embedded.EJBContainerProviderImpl threw unexpected exception at create EJBContainer:
java.lang.NoSuchMethodError
java.lang.NoSuchMethodError: com.sun.enterprise.module.bootstrap.StartupContext.(Ljava/io/File;Ljava/io/File;[Ljava/lang/String;)V
at org.glassfish.api.embedded.Server.(Server.java:277)
at org.glassfish.api.embedded.Server.(Server.java:61)
at org.glassfish.api.embedded.Server$Builder.build(Server.java:158)
at org.glassfish.api.embedded.Server$Builder.build(Server.java:140)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.init(EJBContainerProviderImpl.java:151)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:118)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
at org.rle.ecenter.ws.eCenterServiceTest.setUpClass(eCenterServiceTest.java:61)
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:518)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)

javax.ejb.EJBException: No EJBContainer provider available
Provider named org.glassfish.ejb.embedded.EJBContainerProviderImpl threw unexpected exception at create EJBContainer:
java.lang.NoSuchMethodError
java.lang.NoSuchMethodError: com.sun.enterprise.module.bootstrap.StartupContext.(Ljava/io/File;Ljava/io/File;[Ljava/lang/String;)V
at org.glassfish.api.embedded.Server.(Server.java:277)
at org.glassfish.api.embedded.Server.(Server.java:61)
at org.glassfish.api.embedded.Server$Builder.build(Server.java:158)
at org.glassfish.api.embedded.Server$Builder.build(Server.java:140)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.init(EJBContainerProviderImpl.java:151)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:118)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
at org.--.--.--.--Test.setUpClass(eCenterServiceTest.java:61)

at javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:186)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:121)
at org.--.--.--.--Test.setUpClass(eCenterServiceTest.java:61)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
yahya_h
Offline
Joined: 2010-09-14

i have downloaded the latest embedded glassfish embedded-all 3.1-b20 when i run the test i get this output

------------- Standard Error -----------------
22.09.2010 14:11:51 com.sun.logging.LogDomains$1 log
SCHWERWIEGEND: ejb.embedded.location_not_exists
22.09.2010 14:11:52 com.sun.enterprise.glassfish.bootstrap.EmbeddedNonOSGiGlassFishRuntimeBuilder provisionInstanceRoot
WARNUNG: AS_DEF_DOMAINS_PATH is not set.
22.09.2010 14:11:52 com.sun.enterprise.util.EarlyLogger add
INFO: Total time to parse domain.xml: 119 milliseconds
22.09.2010 14:11:59 com.sun.logging.LogDomains$1 log
INFO: GlassFish Server Open Source Edition 3.1-b20 (java_re-private) startup time : Embedded(687ms) startup services(6016ms) total(6703ms)
22.09.2010 14:11:59 com.sun.logging.LogDomains$1 log
INFO: enterprise_used_delegate_name
22.09.2010 14:11:59 com.sun.logging.LogDomains$1 log
INFO: JMXStartupService: JMXConnector system is disabled, skipping.
22.09.2010 14:11:59 AppServerStartup run
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
22.09.2010 14:11:59 com.sun.logging.LogDomains$1 log
INFO: ... skipping... glassfish-embedded-all-3.1-b20.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.resource.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.security.jacc.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... bean-validator.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.servlet.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.management.j2ee.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.ejb.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.security.auth.message.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... jstl-impl.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.jms.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.transaction.jar
22.09.2010 14:12:07 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.annotation.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.servlet.jsp.jstl.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.enterprise.deploy.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: ... skipping... javax.servlet.jsp.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive arquillian-testenricher-resource-1.0.0.Alpha4.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive jsf-impl.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive javax.persistence.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive arquillian-protocol-servlet-3-1.0.0.Alpha4.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive webservices-api-osgi.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive ant-launcher.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive jsr311-api.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive 72080.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive rle-utils.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive junit-4.5.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive classes
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive arquillian-testenricher-cdi-1.0.0.Alpha4.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive jsf-api.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive shrinkwrap-extension-glassfish-1.0.0-alpha-11.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive arquillian-spi-1.0.0.Alpha4.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive jaxb-api-osgi.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding EJB module to ScatteredArchive classes
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive javac-api-nb-7.0-b07.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive shrinkwrap-impl-base-1.0.0-alpha-11.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive weld-osgi-bundle.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive mail.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive javaee.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive arquillian-impl-base-1.0.0.Alpha4.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive shrinkwrap-api-1.0.0-alpha-11.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive arquillian-junit-1.0.0.Alpha4.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive junit-4.8.1.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive shrinkwrap-spi-1.0.0-alpha-11.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive arquillian-api-1.0.0.Alpha4.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive arquillian-testenricher-ejb-1.0.0.Alpha4.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [DeploymentElement] adding library to ScatteredArchive ant.jar
22.09.2010 14:12:08 com.sun.logging.LogDomains$1 log
INFO: [EJBContainerImpl] Deploying app: org.glassfish.api.embedded.ScatteredArchive@f0cb3c located at null
22.09.2010 14:14:22 com.sun.logging.LogDomains$1 log
SCHWERWIEGEND: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
22.09.2010 14:14:22 com.sun.logging.LogDomains$1 log
SCHWERWIEGEND: Exception while preparing the app
22.09.2010 14:14:22 com.sun.logging.LogDomains$1 log
INFO: [EJBContainerProviderImpl] Cleaning up on failure ...
22.09.2010 14:14:22 com.sun.logging.LogDomains$1 log
INFO: JMXStartupService and JMXConnectors have been shut down.
22.09.2010 14:14:22 com.sun.logging.LogDomains$1 log
INFO: Shutdown procedure finished
22.09.2010 14:14:22 AppServerStartup run
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] exiting
22.09.2010 14:14:33 com.sun.logging.LogDomains$1 log
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:147)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:128)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:120)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:96)
at org.rle.ecenter.ws.eCenterServiceTest.setUpClass(eCenterServiceTest.java:73)
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:518)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)

mvatkina
Offline
Joined: 2005-04-04

There are known problems with handling OSGi modules in the classpath. But why do you have all these modules in the classpath in addition to glassfish-embedded-all-3.1-b20.jar that contains all of GlassFish?

-marina

yahya_h
Offline
Joined: 2010-09-14

i have the same error with or without the modules
and i need them to test my app with arquillian

mvatkina
Offline
Joined: 2005-04-04

Try the next nightly or promoted build. The bug that suppressed the actual messages should've been fixed.

yahya_h
Offline
Joined: 2010-09-14

where can i found it, i mean the embedded-all

i have download (b21) but i still have the same probelm

Message was edited by: yahya_h

mvatkina
Offline
Joined: 2005-04-04

Is your database configured and started? There is JPA problem somewhere:

SCHWERWIEGEND: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method

You can get the latest jar at http://gf-hudson.sfbay.sun.com/hudson/job/gf-trunk-embedded-publisher

-marina

mvatkina
Offline
Joined: 2005-04-04

For the mvn dependency, try 3.1-SNAPSHOT version, or to download it outside Oracle networks, use http://download.java.net/maven/glassfish/org/glassfish/extras/glassfish-...

-marina

yahya_h
Offline
Joined: 2010-09-14

Hi Marina,
thank you for your answer.
i have found the latest build and downloaded it, now i'm using b22, i still have the same problem, i'm using another port than the usual port could be that this is the reason for my error???

Yahya

Message was edited by: yahya_h

mvatkina
Offline
Joined: 2005-04-04

You are yousing embeddable EJB container. Which ports are you referring to?

-marina

yahya_h
Offline
Joined: 2010-09-14

i'm using port 8585

mvatkina
Offline
Joined: 2005-04-04

Check if you have more than one version of GF jars in the classpath.

-marina

yahya_h
Offline
Joined: 2010-09-14

hello,
thank you for your replay
i have tried all options what i have found in the net. like adding embedded
now i have deleted all embedded glassfish jar files but glassfish-embedded-static-shell.jar (as i have red it should use the installed one)
witch was there at the beginning. now i get the error
No EJBContainer provider available: no provider names had been found.
javax.ejb.EJBException: No EJBContainer provider available: no provider names had been found.
at javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:186)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:121)
at org.rle.ecenter.ws.eCenterServiceTest.setUpClass(eCenterServiceTest.java:61)

with this code to initiate the glassfish:

Map properties = new HashMap();
properties.put(EJBContainer.MODULES, new File("C:/Dokumente und Einstellungen/menamet/Eigene Dateien/NetBeansProjects/eCenter-WebServices/build/test/classes"));
properties.put("org.glassfish.ejb.embedded.glassfish.installation.root",
"C:/ProgrammFiles/glassfish/glassfish/domains/domain1");
EJBContainer container = EJBContainer.createEJBContainer(properties); <--------- here where the error occurs
Context ctx = container.getContext();
when i use it without the properties i get the same error.

EJBContainer container = EJBContainer.createEJBContainer(properties);
Yahya

Alexis Moussine-Pouchkine

how do you launch the test?

On 17 sept. 2010, at 08:48, glassfish@javadesktop.org wrote:

> hello,
> thank you for your replay
> i have tried all options what i have found in the net. like adding embedded
> now i have deleted all embedded glassfish jar files but glassfish-embedded-static-shell.jar (as i have red it should use the installed one)
> witch was there at the beginning. now i get the error
> No EJBContainer provider available: no provider names had been found.
> javax.ejb.EJBException: No EJBContainer provider available: no provider names had been found.
> at javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:186)
> at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:121)
> at org.rle.ecenter.ws.eCenterServiceTest.setUpClass(eCenterServiceTest.java:61)
>
> with this code to initiate the glassfish:
>
> Map properties = new HashMap();
> properties.put(EJBContainer.MODULES, new File("C:/Dokumente und Einstellungen/menamet/Eigene Dateien/NetBeansProjects/eCenter-WebServices/build/test/classes"));
> properties.put("org.glassfish.ejb.embedded.glassfish.installation.root",
> "C:/ProgrammFiles/glassfish/glassfish/domains/domain1");
> EJBContainer container = EJBContainer.createEJBContainer(properties); <--------- here where the error occurs
> Context ctx = container.getContext();
> when i use it without the properties i get the same error.
>
> EJBContainer container = EJBContainer.createEJBContainer(properties);
> Yahya
> [Message sent by forum member 'yahya_h']
>
> http://forums.java.net/jive/thread.jspa?messageID=483023
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

yahya_h
Offline
Joined: 2010-09-14

in NB right klick on the testclass und run test.

i have tried to use maven, it had downloaded an embedded glassfish after that i have used it in my project and deleted all other glassfish instances now i get this error
javax.ejb.EJBException: Failed to deploy EJB modules - see log for details

yahya

devalentino
Offline
Joined: 2011-08-24

Have you found solution for your problem?