I believe there was a synchronization bug in class loading in Felix 0.8.0 that opened a window for defining the same class more than once...this was fixed in later versions of Felix...so, you might want to go back to trying to solve the URL handler issue on Felix 1.0.1...perhaps you should try the latest trunk build, since there were some changes that might impact the URL handler stuff...regardless, were better off trying to get you on 1.0.x than 0.8.0...

-> richard

GERODOLLE Anne RD-MAPS-GRE wrote:
Hi all,

I got into classloading problems using log4j on felix and jamvm, as soon
as I try to use log4j, for example calling Logger.getLogger.
I'm including below a piece of code that exhibits the problem.
The corresponding bundle works OK on felix on sun's VM .
It works OK on prosyst mbs on jamvm.

On felix on jamvm, I obtain a "duplicate class error", whether I'm using
the log4j bundle from felix or embedding directly log4j in my test
bundle.

I'm using felix-0.8.0, due to unresolved problems with felix 1.0.1 on
jamvm I mentionned earlier on this list ("unknown protocol: felix").

I have found a workaround : loading the "Priority" class in advance, by
adding a line like Priority debug = Priority.DEBUG;
But this means that I have to change the code of all bundles that use
log4j :(

Here is the "start" method of my activator :

public void start(BundleContext context){
    System.out.println("defining a variable of the
org.apache.log4j.Level class");
    org.apache.log4j.Level level;
    System.out.println("now trying to instantiate this variable");
level=org.apache.log4j.Level.DEBUG; }

And here is the stack trace :
ERROR: Error starting
file:/home/gerodol/.m2/repository/com/francetelecom/osgi/test/log4j-test
/0.1-SNAPSHOT/log4j-test-0.1-SNAPSHOT.jar
(org.osgi.framework.BundleException: Activator start error.)
java.lang.NoClassDefFoundError: org/apache/log4j/Level
   at com.francetelecom.test.LoggerTest.start(LoggerTest.java:38)
   at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction
.java:509)
   at org.apache.felix.framework.Felix._startBundle(Felix.java:1260)
   at org.apache.felix.framework.Felix.startBundle(Felix.java:1201)
   at
org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:807)
   at
org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:256)
   at java.lang.Thread.run(Thread.java:710)
Caused by: java.lang.LinkageError: duplicate class definition
   at java.lang.VMClassLoader.defineClass(Native Method)
   at
java.lang.VMClassLoader.defineClassWithTransformers(VMClassLoader.java:3
74)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:472)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:437)
   at
org.apache.felix.framework.searchpolicy.ContentClassLoader.findClass(Con
tentClassLoader.java:149)
   at
org.apache.felix.framework.searchpolicy.ContentClassLoader.loadClassFrom
Module(ContentClassLoader.java:51)
   at
org.apache.felix.framework.searchpolicy.ContentLoaderImpl.getClass(Conte
ntLoaderImpl.java:121)
   at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrRe
source(R4SearchPolicyCore.java:358)
   at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4S
earchPolicyCore.java:136)
   at
org.apache.felix.framework.searchpolicy.R4SearchPolicy.findClass(R4Searc
hPolicy.java:45)
   at
org.apache.felix.framework.searchpolicy.ContentClassLoader.loadClass(Con
tentClassLoader.java:70)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
   at com.francetelecom.test.LoggerTest.start(LoggerTest.java:38)

Thanks in advance,

Anne

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to