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]