3

For a school assignment I received a Netbeans project using JNDI and JMS with Glassfish (3 open source edition). All the Glassfish libraries this application is using are referenced by absolute path and all the other libraries (in the "lib" folder) are referenced by relative path.

Since my group is working with a version control system the "lib" folder is included in the repository. This works fine because it is a small project. However the Glassfish libraries are problematic as I am a Linux user and the others are Windows users. We have worked around this problem by letting Netbeans take care of the library paths.

The chosen solution 'works' but is not the best solution. I thought Maven would be a better solution.

However the "gf-client" library is giving problems. Whenever I use the Maven "gf-client" the application throw an exception:

javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

Both libraries have "3.1.2" as version. The structures of the libraries look identical and both MANIFEST.MF files too. The size and the md5sum of both files however are not equal.

I've tried all "gf-client" libraries I could find in the default Maven repository and none worked. No other library gives me problems.

siebz0r
  • 18,867
  • 14
  • 64
  • 107

1 Answers1

9

Was able to resolve it by adding this to my pom.xml:

<dependency>
    <groupId>org.glassfish.main.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>3.1.2</version>
</dependency>

The gf-client jar is referring to classes in other jars. The first class it was missing was probably java.naming.factory.initial. But after fixing this it still needed a bunch of other classes. Quickest way for me was to add the glassfish-embedded-all dependency.

siebz0r
  • 18,867
  • 14
  • 64
  • 107