That is excellent news, especially since it helps us to debug the situation...now I can go beat on Karl... ;-)

-> richard

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

I've "solved" the issue by commenting out the static initialisation in ExtensionManager. 
It's still completely obscure for me, I just searched the code and found this 
"felix://extension" URL that was only refered there.

Now eveything looks OK (at least I can run log4j correctly, and instantiate a 
"SimpleDateFormat". Of course now I have to test the complete application...

I put some output traces in the code, and it turned out that there was an (almost) 
infinite recursion in UrlHandlers.createURLStreamHandler, trying to create a streal 
handler for the "felix" protocol.

Conerning jamvm, for these tests I used a debian package.

Best regards,

Anne
-----Message d'origine-----
De : Richard S. Hall [mailto:[EMAIL PROTECTED] Envoyé : mardi 4 décembre 2007 16:40
À : [email protected]
Objet : Re: Problem with log4j on felix and jamvm

Well, the issue for me is that I currently cannot compile JamVM for fedora (my 
machine's gcc installation seems to be messed up somehow and I have been unable 
to fix it)...I will work on getting JamVM working...if anyone knows of some 
binary RPMs for it and/or GNU Classpath that would greatly help.

Once I can run JamVM, then perhaps you can send me a boiled down example to 
recreate the situation...feel free to send it any time.

-> richard

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

I've just tried with the last version of felix, that is : I've updated from svn, then run "mvn 
install" from the "main" folder. This downloaded the dependencies from the central 
repository.

Now, here is what happens on jamvm (note that everything works alright on Sun's 
vm):

If I run jamvm without parameters /usr/bin/jamvm -jar bin/felix.jar, and 
without any changes to the generated configuration file :
I get first an "unknown protocol: http" when the obr bundle is loaded, which I 
ignore (because I only want to install bundles from the file system, and it works).

Then, I install the log4j bundle from felix, and then my small example .
Instantiation of the Level class now works (no more "Duplicate class").
but I get : "Unknown protocol: felix" in the initializarion of LogManager, when calling Logger.getLogger(...); This semms to be in fact the same problem as with the HTTP service :
log4j uses "AbsoluteTimeDateFormat", which in turn calls Calendar.getInstance, and this 
results into this "unknown protocol: felix".

If now I type "-Djava.protocol.handle.pkg=gnu.java.net.protocol , the problem with "unknown 
protocol: http" disappears but the "unknown protocol: felix" stay.

If I choose "-Dfelix.service.urlhandlers=false", the calls to Calendar.newInstance simply hang (looks like a deadlock), and the "start" method of an activator calling "new SimpleDateFormat" just never returns.
I agree with you that I have to solve the URL handler issue in felix 1.0.1 . 
But I have no clue how to proceed.

Best regards,

Anne


-----Message d'origine-----
De : Richard S. Hall [mailto:[EMAIL PROTECTED] Envoyé : lundi 3 décembre 2007 21:26 À : [email protected] Objet : Re: Problem with log4j on felix and jamvm

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-t
e st /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(SecureAct
i
on
.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.jav
a
: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(
C
on
tentClassLoader.java:149)
   at
org.apache.felix.framework.searchpolicy.ContentClassLoader.loadClassF
r
om
Module(ContentClassLoader.java:51)
   at
org.apache.felix.framework.searchpolicy.ContentLoaderImpl.getClass(Co
n
te
ntLoaderImpl.java:121)
   at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassO
r
Re
source(R4SearchPolicyCore.java:358)
   at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(
R
4S
earchPolicyCore.java:136)
   at
org.apache.felix.framework.searchpolicy.R4SearchPolicy.findClass(R4Se
a
rc
hPolicy.java:45)
   at
org.apache.felix.framework.searchpolicy.ContentClassLoader.loadClass(
C
on
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]


---------------------------------------------------------------------
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]


---------------------------------------------------------------------
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