dev@glassfish.java.net

Re: Location of User JARs in GlassFish ?

From: Sahoo <Sahoo_at_Sun.COM>
Date: Thu, 28 Aug 2008 13:29:55 +0530

Arun,

The location of the driver jars is not the issue. In fact, one should
not use glassfish/lib for JDBC drivers. domain_dir/lib is a more
appropriate place for JDBC drivers.

I looked at com.sun.gjc.common.DataSourceObjectBuilder
getDataSourceObject. The reason you are seeing this issue is that
Thread's context class loader is not set to CommonClassLoader during
that operation. An issue has been already filed. See
https://glassfish.dev.java.net/issues/show_bug.cgi?id=5596

Add your test case there so that engineer making the fix can test your
use case as well.

In the mean while, as a work around, you can put the jars in jre/lib/ext
or domain1/lib/ext. If you do decide to put it in domain/lib/ext, then
you must set -Djava.ext.dirs properly while starting using java -jar
glassfish.jar. This is not needed while starting server using asadmin
command.

Thanks,
Sahoo

Arun Gupta wrote:
> Ok, this is deploying a Rails application in v3.
>
> I copied MySQL Connector/J jar in JRUBY_HOME/lib and so it can find
> com.mysql.jdbc.Driver. But Felix throws the CNF exception as
>
> Aug 27, 2008 9:04:16 PM com.sun.gjc.common.DataSourceObjectBuilder
> getDataSourceObject
> SEVERE: jdbc.exc_cnfe_ds
> java.lang.ClassNotFoundException:
> com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
> at
> org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:200)
>
> at
> org.apache.felix.framework.searchpolicy.R4SearchPolicy.findClass(R4SearchPolicy.java:45)
>
> at
> org.apache.felix.framework.searchpolicy.ContentClassLoader.loadClass(ContentClassLoader.java:109)
>
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>
> This class indeed exists in Connector/J jar. Where do you recommend
> this JAR needs to be copied so that it can found at runtime ?
>
> -Arun
>
> Sahoo wrote:
>> Don't expect an OSGi module to be able to load classes from
>> domain/lib or lib. Only application class loaders have visibility to
>> those libraries.
>>
>> Thanks,
>> Sahoo
>>
>> Arun Gupta wrote:
>>> With 8/24 nightly, dropping a JAR file in lib directory does not
>>> seem to get picked up.
>>>
>>> 8/25: nightly not there
>>> 8/26: Rails is broken
>>> 8/27: Startup gives the error:
>>>
>>> -- cut here --
>>> Aug 27, 2008 5:08:43 PM
>>> SEVERE: com.sun.enterprise.module.ResolveError: Failed to start
>>> org.glassfish.web.web-cli(Web module command line
>>> interface):10.0.0.SNAPSHOT
>>> Aug 27, 2008 5:08:43 PM
>>> SEVERE: at
>>> org.jvnet.hk2.osgiadapter.OSGiModuleImpl.resolve(OSGiModuleImpl.java:111)
>>>
>>> Aug 27, 2008 5:08:43 PM
>>> SEVERE: at
>>> org.jvnet.hk2.osgiadapter.OSGiModuleImpl.start(OSGiModuleImpl.java:120)
>>> Aug 27, 2008 5:08:43 PM
>>> SEVERE: at
>>> org.jvnet.hk2.osgiadapter.OSGiModuleImpl$1$1.loadClass(OSGiModuleImpl.java:252)
>>>
>>> Aug 27, 2008 5:08:43 PM
>>> -- cut here --
>>>
>>> Where can I drop a JAR file in GlassFish so that it gets picked up ?
>>>
>>> -Arun
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>