You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Gareth Collins <ga...@gmail.com> on 2011/09/10 02:30:24 UTC

A Weird Issue

Hello all,

I have a weird issue. It is not a major issue and I can get around it,
but I thought I should raise it just in case someone else has a
similar problem.

My development environment is eclipse. My bundles are PDE projects so
it is easy for me to run and debug during development. I have a run
configuration which starts the equinox OSGi framework and loads and
starts my bundles. As part of my development I have used java security
extensions and the java sax parser. Equinox in eclipse is quite happy
with me not defining javax.security.* and org.xml.sax.* as imports in
my manifests (as I assume these are standard parts of java). I am
using java security and the SAX parser from a wab.

As I got some significant functionality running in equinox, I have
decided to move back to karaf 2.2.3 (felix) for an integration test,
test cellar/hazelcast with multiple machines etc. and try to figure
out how I would deploy. I currently have all these features installed
(as well as my own features):

State         Version           Name
Repository               Description
[installed  ] [1.9.3          ] hazelcast
repo-0                   In memory data grid
[installed  ] [2.2.2          ] cellar
repo-0                   Karaf clustering
[installed  ] [2.2.2          ] cellar-webconsole
repo-0                   Karaf Cellar Webconsole Plugin
[installed  ] [3.0            ] guice
repo-0                   Google Guice
[installed  ] [3.0.6.RELEASE  ] spring
karaf-2.2.3
[installed  ] [1.2.1          ] spring-dm
karaf-2.2.3
[installed  ] [2.2.3          ] obr
karaf-2.2.3
[installed  ] [2.2.3          ] config
karaf-2.2.3
[installed  ] [7.4.5.v20110725] jetty
karaf-2.2.3
[installed  ] [2.2.3          ] http
karaf-2.2.3
[installed  ] [2.2.3          ] war
karaf-2.2.3
[installed  ] [2.2.3          ] webconsole-base
karaf-2.2.3
[installed  ] [2.2.3          ] webconsole
karaf-2.2.3
[installed  ] [2.2.3          ] ssh
karaf-2.2.3
[installed  ] [2.2.3          ] management
karaf-2.2.3
[installed  ] [1.2.0-SNAPSHOT ] shiro-core
shiro-1.2.0-SNAPSHOT
[installed  ] [1.2.0-SNAPSHOT ] shiro-web
shiro-1.2.0-SNAPSHOT
[installed  ] [5.5.0          ] activemq
activemq-5.5.0
[installed  ] [5.5.0          ] activemq-blueprint
activemq-5.5.0
[installed  ] [5.5.0          ] activemq-web-console
activemq-5.5.0

When I try and run my wars in Karaf, karaf throws ClassNotFound
exceptions on the following:

org.xml.sax.helpers.DefaultHandler
javax.security.auth.x500.X500Principal

I added the org.xml.sax.helpers and javax.security.auth.x500 into the
relevant Manifests and Karaf is now happy (I don't need to add
org.xml.sax.* or javax.security.* even though I use other sax and java
security classes).

Thinking this is a Felix issue, I created two vanilla instances of
Karaf 2.2.3, one using equinox and one using Felix.

I created a test bundle which did the following (without adding
org.xml.sax.helpers or javax.security.auth.x500 to the manifest):

package com.mytestcompany.importtest;

import javax.security.auth.x500.X500Principal;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.xml.sax.helpers.DefaultHandler;

public class Activator implements BundleActivator {

	@Override
	public void start(BundleContext arg0) throws Exception {
		X500Principal principal = new X500Principal("CN=Fred");
		DefaultHandler defaultHandler = new DefaultHandler();
		
		System.out.println("Initialized successfully");
	}
.
.
}

Both the equinox and felix versions of Karaf printed "Initialized
successfully" without a problem...so it doesn't appear there is an
obvious problem with felix.

Any ideas what may be messed up? I was wondering whether it could be a
pax web issue, but I have Pax Web setup in eclipse as well (though I
am using pax web 1.1.1./pax url 1.3.4 in equinox vs. pax web 1.0.6/pax
url 1.2.8 as part of Karaf 2.2.3).

I guess this isn't that important as I can get around it, but if
anyone had any ideas what could cause the issue it would be much
appreciated.

thanks in advance,
Gareth

Re: A Weird Issue

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Gareth,

Yes, we plan to upgrade to OSGi 4.3 in Karaf 3.0.0. It includes new 
version of Equinox and Felix frameworks.

I started to work on it (update of the Main related to the new framework 
method signatures).

Regards
JB

On 09/11/2011 12:50 AM, Gareth wrote:
> All,
>
> I did some more testing, finding even more issues with felix classloading.
> In a certain scenario I was even having problems loading a wab's classes
> (some loaded correctly and some ClassNotFoundException).
>
> I rebuilt my karaf environment using equinox, and all classes loaded
> correctly, so I guess this problem is with Felix. In looking at the Felix
> JIRA issues I see many related to classloading (many to be fixed in Felix
> 4.0.0). I see Karaf is using an old version of Felix (3.0.9 - current is
> 3.2.2). Is there a plan to upgrade to upgrade Karaf for a more current Felix
> version (e.g. Felix 4.0.0 for Karaf 3.0.0)? For now it looks like I will
> stick with equinox. I assume equinox will continue to be supported moving
> forward?
>
> thanks in advance,
> Gareth
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/A-Weird-Issue-tp3324424p3326033.html
> Sent from the Karaf - User mailing list archive at Nabble.com.

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: A Weird Issue

Posted by Gareth <ga...@gmail.com>.
All,

I did some more testing, finding even more issues with felix classloading.
In a certain scenario I was even having problems loading a wab's classes
(some loaded correctly and some ClassNotFoundException).

I rebuilt my karaf environment using equinox, and all classes loaded
correctly, so I guess this problem is with Felix. In looking at the Felix
JIRA issues I see many related to classloading (many to be fixed in Felix
4.0.0). I see Karaf is using an old version of Felix (3.0.9 - current is
3.2.2). Is there a plan to upgrade to upgrade Karaf for a more current Felix
version (e.g. Felix 4.0.0 for Karaf 3.0.0)? For now it looks like I will
stick with equinox. I assume equinox will continue to be supported moving
forward?

thanks in advance,
Gareth




--
View this message in context: http://karaf.922171.n3.nabble.com/A-Weird-Issue-tp3324424p3326033.html
Sent from the Karaf - User mailing list archive at Nabble.com.