users@glassfish.java.net

Re: Add libraries to application server

From: Sivakumar Thyagarajan <Sivakumar.Thyagarajan_at_Sun.COM>
Date: Fri, 10 Aug 2007 16:07:34 +0530

glassfish_at_javadesktop.org wrote:
> How should I add libraries that should be generally available on the application server?

Please see the answer to the question "How do I control visibility scope of my
libraries? " at
http://blogs.sun.com/sivakumart/entry/classloaders_in_glassfish_an_attempt

>
> I have an application with two parts, an EJB application deployed on glassfish and a standalone java SE application.
>
> From the standalone application I try to bind a class in JNDI, this fails with a ClassNotFoundException because the class I'm trying to bind is a custom class.
> How should I add the jar containing this class to the application server?

How is the binding done? Is the binding to JNDI provided in a standalone java
client without the bound class in the classpath? If yes, this wouldn't work.
Please provide stacktrace/more information.

>
> The custom class is bundled in my EJB jar but that doesn't help.
> Are libraries deployed as part of EJB modules supposed to be generally available (to JNDI as well), i.e. is there something wrong with my EJB jar?
> Or should I add the jar to the classpath in some other way?

Libraries bundled with a EJB jar is only available to that EJB application.
Please refer to the classloader hierarchy at
https://glassfish.dev.java.net/nonav/javaee5/docs/DG/beade.html for more
information.

The class bound to JNDI should also be available to the application performing
the lookup.

> It works if I add the jar to the lib folder of the application server and
restart it but if it's possible to add it
> without having to restart the application server, that would be a lot better...

All the jars placed in domain-dir/lib are automatically added to the application
server classpath and hence this works. If you want to scope the libraries to a
particular application, you could also use --libraries option as explained at
https://glassfish.dev.java.net/nonav/javaee5/docs/DG/beade.html#gatej

Thanks
--Siva.

> [Message sent by forum member 'krippa' (krippa)]
>
> http://forums.java.net/jive/thread.jspa?messageID=230398
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>