users@glassfish.java.net

Re: third party jars

From: Hong Zhang <hong.hz.zhang_at_oracle.com>
Date: Tue, 10 Aug 2010 09:33:35 -0400

> Put json and its dependencies in <glassfish-v3-prelude home>/lib/
>
>
>
> Stopped and started glassfish v3 (don't know for sure that it can see
> libs without a restart).
>
>
>
> Deployed, ran, CRASHED -- oooohhhhhh, so painful!
>
>
>
> I thought I had read that application dependencies no longer belong in
> the glassfish lib directory.
>
The applibs directory is for application specific libraries when you use
the --libraries option, but I think the lib directory should work too
even though everything you put in there will be visible to all
applications.
I noticed your glassfish installation directory is called
<glassfish-v3-prelude home>, is this a v3 prelude installation?
>
>
>
>
>
> *From:* Steven Siebert [mailto:smsiebe_at_gmail.com]
> *Sent:* Tuesday, August 10, 2010 8:31 AM
> *To:* users_at_glassfish.dev.java.net
> *Subject:* Re: Re: Re: third party jars
>
>
>
> Just did a double-check and noticed that the "offending" class isn't a
> nested dependency, just the dependency itself =). Slap that jar
> (json-lib-2.3-jdk15.jar) into the lib directory, along with the
> dependencies.../should/ work...=)
>
> EJB modules are suppose to be deployed as .jar files, as defined in
> the spec. It's not a netbeans-specific thing =)
>
> EE packaging/deployment management has a long way to go, IMHO, which
> is why I'm looking more and more of making a transition to a OSGi
> based framework. I know GFv3 is making strides in exposing OSGi to
> the application developers - but it's not quick enough for my current
> projects.
>
> Hope it works this time =)
>
> S
>
> On Tue, Aug 10, 2010 at 8:20 AM, Martin, Ray <armart3_at_tycho.ncsc.mil
> <mailto:armart3_at_tycho.ncsc.mil>> wrote:
>
> My good old faithful netbeans wraps up an EJBModule project into a jar
> file. (if I knew how, I would ask netbeans to make it a .war file
> since that deploys and runs.)
>
>
>
> Put the third party jars into <glassfish-v3-prelude
> home>/domains/domain1/lib/
>
>
>
> Same crash.
>
>
>
> That was a good thing to try -- I am disappointed that it didn't work.
>
>
>
> I am thinking about creating a netbeans web app that has no web pages
> -- just the source package (they call it). If this would get me going
> temporarily would be just great, but I hate to have to do that.
>
>
>
> *From:* Steven Siebert [mailto:smsiebe_at_gmail.com
> <mailto:smsiebe_at_gmail.com>]
> *Sent:* Tuesday, August 10, 2010 8:08 AM
>
>
> *To:* users_at_glassfish.dev.java.net <mailto:users_at_glassfish.dev.java.net>
>
> *Subject:* Re: Re: third party jars
>
>
>
> Are you packaging this as a EJB .jar, a .war, or an .ear?
>
> I wonder if you copy those nested dependencies to your GF domains /lib
> directory would everything work?
>
> S
>
> On Tue, Aug 10, 2010 at 7:49 AM, Martin, Ray <armart3_at_tycho.ncsc.mil
> <mailto:armart3_at_tycho.ncsc.mil>> wrote:
>
> json-lib-2.3-jdk15.jar
>
>
>
> deployment is fine.
>
>
>
> Runtime provides this error:
>
> java.lang.ClassNotFoundException: net.sf.json.JSONArray
>
>
>
> no errors on compile.
>
>
>
> Admittedly, json depends on other third party jars (4 commons-*.jar,
> and ezmorph-x.x.jar). I have included these jars as libraries in the
> project and they are all packaged in the project jar in the dist
> directory. Everything appears to be in the correct place. But,
> runtime errors.
>
>
>
> Made an SE app that uses the same JPA and third party jars does not
> crash (of, course glassfish is not used here -- this is just a proof
> of correct jars).
>
>
>
> A web app that uses the same EJBs, JPA, and third party jars does not
> crash. This shows that the third party jars CAN occur from glassfishv3.
>
>
>
> While the web app in glassfishv3 works, the EJBModule app does not.
> Strange thing is that the oracle third party library, ojdbc14_g.jar,
> works in all projects even the EJBModule project.
>
>
>
> I wonder if the classloader in v3 for EJB modules is not properly
> loading the jars on which a third party jar is relying.
>
>
>
> *From:* Steven Siebert [mailto:smsiebe_at_gmail.com
> <mailto:smsiebe_at_gmail.com>]
> *Sent:* Tuesday, August 10, 2010 7:36 AM
> *To:* users_at_glassfish.dev.java.net <mailto:users_at_glassfish.dev.java.net>
> *Subject:* Re: third party jars
>
>
>
> What is the 3rd part JSON library you're using? What is the error
> your receiving on deployment?
>
> I assume you're not getting any errors on compile...
>
>
> Steve
>
> On Tue, Aug 10, 2010 at 7:33 AM, Martin, Ray <armart3_at_tycho.ncsc.mil
> <mailto:armart3_at_tycho.ncsc.mil>> wrote:
>
> Using netbeans 6.8
>
>
>
> Have been working in glassfish v2 -- yesterday switched to v3 -- wow.
> (big changes in the JPA.)
>
>
>
> After many hours of work, got all the errors out of the EJBModule
> project.
>
> It deploys.
>
> It starts when commanded from the SOAP interface.
>
> It crashes as soon as a third party library is called -- JSON in this
> case. Though the oracle library must have been seen because database
> connections are working. The JSON jar has other dependencies like
> commons-*.
>
>
>
> All third party jars have been packaged into the EJBModule jar.
>
>
>
> I built the project in SE using JPA and the third party jars -- runs
> great.
>
> I built a similar project as a web app where the EJBs, JPA, and third
> party jars are used -- runs great.
>
>
>
> Wow -- am I sorry that I changed to v3.
>
>
>
> I have searched and searched -- I cannot be the only guy who has this
> problem -- but, I can find no solution.
>
>
>
> Thought maybe it was netbeans' fault -- so, deployed using admin
> console -- same problem. So, I guess it is a packaging problem??? A
> manifest problem??? wow
>
>
>
>
>
>
>
>
>