Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Please help...Use a library of an other plugin cause ClassNotfoundException
Please help...Use a library of an other plugin cause ClassNotfoundException [message #448566] Wed, 26 April 2006 17:14 Go to next message
Eclipse UserFriend
Originally posted by: mgervais.signaturegenetics.com

Hi,
I've two plugin Plugins A and Plugin B. In Plugin A I've a directory lib
with several jar files used for Glassfish(Sun app server), all jar files are
in my manifest classpath:
Bundle-ClassPath: lib/activation.jar,
lib/admin-cli.jar,
lib/appserv-admin.jar,
lib/appserv-cmp.jar,
lib/appserv-deployment-client.jar,
lib/appserv-ext.jar,
lib/appserv-jstl.jar,
lib/appserv-jwsacc.jar,
lib/appserv-launch.jar,
lib/appserv-rt.jar,
lib/appserv-tags.jar,
lib/appserv-upgrade.jar,
lib/appserv-ws.jar,
lib/com-sun-commons-launcher.jar,
lib/com-sun-commons-logging.jar,
lib/dbschema.jar,
lib/ejb-app.jar,
lib/j2ee.jar,
lib/j2ee-svc.jar,
lib/javaee.jar,
lib/jhall.jar,
lib/jmxremote_optional.jar,
lib/jsf-impl.jar,
lib/mail.jar,
lib/sun-appserv-ant.jar,
lib/toplink-essentials.jar,
lib/toplink-essentials-agent.jar

In thePlugin A Activator I've a getContext Method:
try {
this.context = new InitialContext();
} catch (Exception e) {
e.printStackTrace();
}

and in Plugin B I do
Activator.getDefault().getContext().lookup("com.seryx.data.common.LanguageDAO ");
and I've a ClassNotfound Exception.

But if in my plugin B I do this:

ClassLoader loader= Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(Activator.class .getClassLoader());
try {
LanguageDAO languagedao = (LanguageDAO)
Activator.getDefault().getContext().lookup("com.seryx.data.common.LanguageDAO ");
List<Language> languages = languagedao.findAll();
} catch (Exception e) {
e.printStackTrace();
}
finally{
Thread.currentThread().setContextClassLoader(loader);
}

it works perfectly becausse it use the classloader of Plugin A. But I don't
want to do this .... What's the solution? How can I load classes from Plug A
into Plug B? There is something that I don't understand.
Thanks a lot.
Re: Please help...Use a library of an other plugin cause ClassNotfoundException [message #448584 is a reply to message #448566] Thu, 27 April 2006 08:09 Go to previous messageGo to next message
Eclipse UserFriend
Which plugins has com.seryx.data.common.LanguageDAO? Which classpath is
it on? I assume plugin A's activator is in lib/activator.jar.

Does plugin B require plugin A? It must since you're using plugin A's
activator.

Later,
PW
Re: Please help...Use a library of an other plugin cause ClassNotfoundException [message #448668 is a reply to message #448584] Thu, 27 April 2006 14:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mgervais.signaturegenetics.com

Hi Paul,
Thanks for your answer. I'll give more details.
In fact com.seryx.data.common.LanguageDAO is in PlugA (it's my lib to use
ejb) and in this plugins I've a lib directory with all jars needed for
glassfish(ejb container).
Plug A Activator is not in lib/Activator.jar, but I've this build.properties
file:
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
..,\
plugin.properties,\
workbench.product,\
splash.bmp,\
..options,\
about.mappings,\
icons/,\
lib/
jre.compilation.profile = J2SE-1.5
jars.compile.order = .
And in this Manifest I've this:
Bundle-SymbolicName: com.seryx.workbench.core; singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: com.seryx.workbench.core.internal.Activator
Bundle-Vendor: %Bundle.Vendor
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.update.ui,
org.eclipse.core.runtime
Eclipse-LazyStart: true
Export-Package: com.seryx.data,
com.seryx.data.common,
com.seryx.data.scientific,
com.seryx.workbench.core.internal,
com.seryx.workbench.core.viewers,
com.sun.corba.ee.impl.io,
com.sun.corba.ee.impl.ior,
com.sun.corba.ee.impl.ior.iiop,
com.sun.corba.ee.impl.javax.rmi,
com.sun.corba.ee.impl.javax.rmi.CORBA
Bundle-ClassPath: lib/activation.jar,
lib/admin-cli.jar,
lib/appserv-admin.jar,
lib/appserv-cmp.jar,
lib/appserv-deployment-client.jar,
lib/appserv-ext.jar,
lib/appserv-jstl.jar,
lib/appserv-jwsacc.jar,
lib/appserv-launch.jar,
lib/appserv-rt.jar,
lib/appserv-tags.jar,
lib/appserv-upgrade.jar,
lib/appserv-ws.jar,
lib/com-sun-commons-launcher.jar,
lib/com-sun-commons-logging.jar,
lib/dbschema.jar,
lib/ejb-app.jar,
lib/j2ee.jar,
lib/j2ee-svc.jar,
lib/javaee.jar,
lib/jhall.jar,
lib/jmxremote_optional.jar,
lib/jsf-impl.jar,
lib/mail.jar,
lib/sun-appserv-ant.jar,
lib/toplink-essentials.jar,
lib/toplink-essentials-agent.jar
My Plugin B is dependent of Plug A.
I've tried to add the library.jar for Plug A and library.jar for Plug B and
now I've an exception: java.lang.ClassCastException: javax.naming.Reference,
I don't understand the clasapath issue...
I don't understand why in plug B I can't use library which should bo loaded
in Plug A...
Thanks, for your answer, I think there is something I don't understand with
classpath.
Mickael
"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:e2qcau$9lc$1@utils.eclipse.org...
> Which plugins has com.seryx.data.common.LanguageDAO? Which classpath is
> it on? I assume plugin A's activator is in lib/activator.jar.
>
> Does plugin B require plugin A? It must since you're using plugin A's
> activator.
>
> Later,
> PW
Re: Please help...Use a library of an other plugin cause ClassNotfoundException [message #448671 is a reply to message #448668] Thu, 27 April 2006 14:52 Go to previous messageGo to next message
Eclipse UserFriend
Gervais Mickael wrote:
> Hi Paul,
> Thanks for your answer. I'll give more details.
> In fact com.seryx.data.common.LanguageDAO is in PlugA (it's my lib to use
> ejb) and in this plugins I've a lib directory with all jars needed for
> glassfish(ejb container).
> Plug A Activator is not in lib/Activator.jar, but I've this build.properties
> file:
> source.. = src/
> output.. = bin/

So if your source is in src/ and the output is in bin/, you need to have
a "." on the Bundle-ClassPath as well as your other libraries.

Otherwise there's a good chance that your activator class wasn't added
to the plugin. Of course that doesn't explain the context class loading
scenario.

Here's a list I use when adding 3rd party jars to a plugin with an
activator:
http://wiki.eclipse.org/index.php/PDE

Later,
PW
Re: Please help...Use a library of an other plugin cause ClassNotfoundException [message #448672 is a reply to message #448671] Thu, 27 April 2006 15:40 Go to previous message
Eclipse UserFriend
Originally posted by: mgervais.signaturegenetics.com

Hi,
thanks for the answer, apparently it works, but I had to export all the
package in the plugin a... I don't why exactly, it should be due to the use
of glassfish...
Have a good day and thanks again.
Mickael

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:e2r3tb$pr5$1@utils.eclipse.org...
> Gervais Mickael wrote:
>> Hi Paul,
>> Thanks for your answer. I'll give more details.
>> In fact com.seryx.data.common.LanguageDAO is in PlugA (it's my lib to use
>> ejb) and in this plugins I've a lib directory with all jars needed for
>> glassfish(ejb container).
>> Plug A Activator is not in lib/Activator.jar, but I've this
>> build.properties file:
>> source.. = src/
>> output.. = bin/
>
> So if your source is in src/ and the output is in bin/, you need to have a
> "." on the Bundle-ClassPath as well as your other libraries.
>
> Otherwise there's a good chance that your activator class wasn't added to
> the plugin. Of course that doesn't explain the context class loading
> scenario.
>
> Here's a list I use when adding 3rd party jars to a plugin with an
> activator:
> http://wiki.eclipse.org/index.php/PDE
>
> Later,
> PW
Previous Topic:compile warnings in rcp headless build
Next Topic:Apply your SWT / Swing / Eclipse experience in Investment Banking project - Raj Kapoor
Goto Forum:
  


Current Time: Tue Jul 08 22:18:06 EDT 2025

Powered by FUDForum. Page generated in 0.04385 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top