Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 201303 - Embedded container tests stop working if adding Java-EE-Glassfish-V3 to classpath
Embedded container tests stop working if adding Java-EE-Glassfish-V3 to class...
Product: javaee
Classification: Unclassified
Component: EJB Project
PC Linux
: P1 (vote)
Assigned To: David Konecny
Depends on:
  Show dependency treegraph
Reported: 2011-08-25 04:43 UTC by pablopina
Modified: 2011-09-08 11:20 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description pablopina 2011-08-25 04:43:08 UTC
Steps to reproduce it:

1) Create EJB project with a Stateless Session Bean and a unit test for it
2) run test (runs ok)
3) Add to the project Java-EE-Glassfish-V3
4) run test again: fails
5) Remove library Java-EE-Glassfish-V3 from ejb project
4) run test again: fails again. Tests will never again run.

Failure message:

javax.ejb.EJBException: No EJBContainer provider available: no provider names had been found.
	at javax.ejb.embeddable.EJBContainer.reportError(
	at javax.ejb.embeddable.EJBContainer.createEJBContainer(
	at javax.ejb.embeddable.EJBContainer.createEJBContainer(
	at ejbs.NewSessionBeanTest.testToString(

Out of curiosity i copy pasted the project folder before adding the Java-EE-Glassfish-V3 and then i did beyond compare on both  project folders after removing Java-EE-Glassfish-V3 so it looks like that removing the library doesn't revert it to its original state:

This is the difference in nbproject/project properties

Before adding Java-EE-Glassfish-V3


Before adding and removing Java-EE-Glassfish-V3

The reason why we add this library is because we want to build and test our Ear project in jenkins / hudson. 

First I tried adding the Java EE 6 Api Library to the project but by doing so the entity metamodel generation throws this 

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/PersistenceException
and trying to run the unit tests throws another java.lang.ClassFormatError.

I don't know the purpose in life of Java EE 6 Api Library is really...
Comment 1 David Konecny 2011-08-26 01:02:33 UTC
I do not mean to offend you Pablo by closing your issues but there is not much to do about this on NB side. It is a messy situation. Why it works in your step #2) is because a jar is added to project classpath from glassfish installation and that jar in its manifest includes via ClassPath attribute dozens of GF jars. That's the scenario I know to work. Everything else never worked for me but perhaps it gets better in newer versions.

If you want to make it pass with Java-EE-Glassfish-V3 then you will have to talk to GF team and ask them why it does not work.

I would suggest to install GlassFish on your hudson and run the tests the same way they are run in IDE. That should work. I never find any other way.
Comment 2 pablopina 2011-08-26 04:48:12 UTC
(In reply to comment #1)

Yes, we did install hudkins and it's running now, but out of frustation....

If we edited the MANIFEST.INF of glassfish-embedded-static-shell.jar and replaced '../../modules/' for '' and then jar it as glassfish-embedded-static-shell-xxx.jar

Could we not then add glassfish-embedded-static-shell-xxx.jar to Java-EE-Glassfish-V3 library as it could then reference all other jars in the same directory?

Thanks David!
Comment 3 David Konecny 2011-08-28 23:47:48 UTC
(In reply to comment #2)
> Could we not then add glassfish-embedded-static-shell-xxx.jar to
> Java-EE-Glassfish-V3 library as it could then reference all other jars in the
> same directory?

In theory you could. Whether it will work is a different story. If you have time to experiment with it and are ready to repackage that way any newer build of GF you may need to use and you accept that newer GF builds/releases may suddenly stop working if repackaged then go for it. :-)

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo