You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by barnesjd <ba...@gmail.com> on 2012/12/21 16:59:27 UTC

[2.3.0] Cannot start war system bundle

Hey guys, I've been playing with a stand-alone Karaf 2.3.0 for a few weeks to
figure out what OSGi is all about.  I've had a lot of success with it until
recently while trying to deploy web archives.  I've created a hello-world
wab with the appropriate manifest entries.  I also have installed the war
system feature.  When I attempt to deploy my wab, it fails to resolve the
'javax.servlet.ServletContextListener' dependency.  I believe this is
because the war feature isn't actually running.  Executing the osgi:list
does not show war as a running bundle.  I can request it to start by running
'osgi:start war'; it asks me if I'm sure I want to start a system bundle to
which I reply with 'yes'... but nothing seems to happen after that. 
Sometimes the prompt returns to me, sometimes it seems to just hang up.  I
don't see the java process running hot or anything.

Does anyone have an idea what I may be doing incorrectly?  Thanks in
advance,

Joe




--
View this message in context: http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [2.3.0] Cannot start war system bundle

Posted by barnesjd <ba...@gmail.com>.
I've decided to take a step back and approach this a little differently.  I'm
not a fan of including my dependencies within the WAB; I was just hopeful
that would make it easier to get something working.  Now I'm attempting to
deploy each dependency as a bundle.  This of course entails the usual
challenge of "OSGi-ifying" several jars that aren't OSGi-ready.  I'm using
BND to help me, but I'm open to anyone's input on how to best rectify
3rd-party libs for OSGi.

I don't doubt that I'm also compounding my complications by attempting this
"Hello World" with Scalatra, which is also new to me.  Hopefully the issues
I'm hitting aren't directly related to that library.

Anyway, I've hit a strange class loading issue while deploying my WAB that I
hope one of you understands:
java.lang.NoClassDefFoundError: org/scalatra/servlet/ScalatraListener (wrong
name: org/scalatra/RailsRouteMatcher$Builder)

The following is my MANIFEST.MF:
Manifest-Version: 1.0
Bnd-LastModified: 1355890216531
Bundle-ManifestVersion: 2
Bundle-Name: com.adtran.aoe.core.ui
Bundle-SymbolicName: com.adtran.aoe.core.ui
Bundle-Version: 0.1
Created-By: 1.6.0_25 (Sun Microsystems Inc.)
Import-Package: org.osgi.framework;version="[1.5,2)",javax.servlet,org.x
 ml.sax,org.xml.sax.helpers,javax.xml.parsers,javax.naming,scala,scala.r
 eflect,org.slf4j,org.scalatra,org.scalatra.servlet
Include-Resource: C:\aoe-modular\com.adtran.aoe.core.ui\src\main\resourc
 es,C:\aoe-modular\com.adtran.aoe.core.ui\src\main\py,C:\aoe-modular\com
 .adtran.aoe.core.ui\target\resource_managed\main
Private-Package: .
Web-ContextPath: helloworld
Webapp-Context: helloworld
Bundle-ClassPath: WEB-INF/classes
Tool: Bnd-1.50.0




--
View this message in context: http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118p4027149.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [2.3.0] Cannot start war system bundle

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Joe,

those jars you import don't look good either. To much stuff that is
provided by the container already :)
The org.osgi.core-4.3.0.jar is definitely not needed there and I also would
recomend to import the slf4j stuff provided by pax-logging.

About your expectations, it does play very well :)
We take care about that and if you start with examples provided by the
documentation either of Karaf or Pax-Web you'll see that those
example or sample war and jar artifacts play nicely with Karaf.

Those samples of pax-web can be found at [1], all of those artifacts are
also available at maven central.

regards and merry Christmas :)

Achim

[1] - https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples




2012/12/23 barnesjd <ba...@gmail.com>

> jbonofre wrote
> > Karaf uses Geronimo *Specs*. So depending the Karaf version that you
> > use, you may have only Servlet Spec 2.5 available (not 3.0).
>
> I'm using Karaf 2.3.0.  Regardless of version, I would expect the system
> modules in Karaf to play well together.  Is it possible that I have
> something misconfigured?
>
> Thanks,
> Joe
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118p4027135.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>

Re: [2.3.0] Cannot start war system bundle

Posted by barnesjd <ba...@gmail.com>.
jbonofre wrote
> Karaf uses Geronimo *Specs*. So depending the Karaf version that you 
> use, you may have only Servlet Spec 2.5 available (not 3.0).

I'm using Karaf 2.3.0.  Regardless of version, I would expect the system
modules in Karaf to play well together.  Is it possible that I have
something misconfigured?

Thanks,
Joe



--
View this message in context: http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118p4027135.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [2.3.0] Cannot start war system bundle

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

Karaf uses Geronimo *Specs*. So depending the Karaf version that you 
use, you may have only Servlet Spec 2.5 available (not 3.0).

Regards
JB

On 12/22/2012 06:24 PM, barnesjd wrote:
> I was coming along well until I hit a ClassNotFoundException for a package
> that I have as an import:
>
> Caused by: java.lang.ClassNotFoundException:
> javax.servlet.FilterRegistration not found by
> org.apache.geronimo.specs.geronimo-servlet_2.5_spec
>
> Is Geronimo something Karaf tries to use under the hood?  I don't think it's
> something I'm explicitly trying to use.
>
> Joe
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118p4027133.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: [2.3.0] Cannot start war system bundle

Posted by barnesjd <ba...@gmail.com>.
I was coming along well until I hit a ClassNotFoundException for a package
that I have as an import:

Caused by: java.lang.ClassNotFoundException:
javax.servlet.FilterRegistration not found by
org.apache.geronimo.specs.geronimo-servlet_2.5_spec

Is Geronimo something Karaf tries to use under the hood?  I don't think it's
something I'm explicitly trying to use.

Joe



--
View this message in context: http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118p4027133.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [2.3.0] Cannot start war system bundle

Posted by barnesjd <ba...@gmail.com>.
David Jencks wrote
> One problem is that your Import-Package header is wrong.  You should list
> packages, not classes.  

*Slaps forehead*... I knew that...


David Jencks wrote
> How did you get this manifest?  If with bnd somehow can you show the
> instructions?

I sorta used BND and sorta hacked it. :) 

Now I'm off finding out everything this WAB depends on.  I wish that that
long list of libs were OSGi bundles themselves... would probably make it
easier to untangle.

Thanks!
Joe





--
View this message in context: http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118p4027132.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [2.3.0] Cannot start war system bundle

Posted by David Jencks <da...@yahoo.com>.
One problem is that your Import-Package header is wrong.  You should list packages, not classes.  How did you get this manifest?  If with bnd somehow can you show the instructions?

I'd expect you would need both javax.servlet and javax.servlet.http at least....

david jencks

On Dec 21, 2012, at 1:44 PM, barnesjd wrote:

> Hey JB, thanks for taking interest in my problem.  
> 
> BTW, if I do not include ServletContextListener as an import, I get a
> ClassNotFoundException
> 
> Here is the contents of my manifest:
> 
> Manifest-Version: 1.0
> Bnd-LastModified: 1355890216531
> Bundle-ManifestVersion: 2
> Bundle-Name: com.adtran.aoe.core.ui
> Bundle-SymbolicName: com.adtran.aoe.core.ui
> Bundle-Version: 0.1
> Created-By: 1.6.0_25 (Sun Microsystems Inc.)
> Import-Package:
> org.osgi.framework;version="[1.5,2)",javax.servlet.ServletContextListener
> Include-Resource: C:\aoe-modular\com.adtran.aoe.core.ui\src\main\resourc
> es,C:\aoe-modular\com.adtran.aoe.core.ui\src\main\py,C:\aoe-modular\com
> .adtran.aoe.core.ui\target\resource_managed\main
> Private-Package: .
> Web-ContextPath: helloworld
> Webapp-Context: helloworld
> Bundle-ClassPath: WEB-INF/classes,WEB-INF/lib/akka-actor-2.0.3.jar,WEB-I
> NF/lib/config-0.3.1.jar,WEB-INF/lib/grizzled-slf4j_2.9.2-0.6.9.jar,WEB-
> INF/lib/logback-classic-1.0.6.jar,WEB-INF/lib/logback-core-1.0.6.jar,WE
> B-INF/lib/org.osgi.core-4.3.0.jar,WEB-INF/lib/rl_2.9.2-0.3.2.jar,WEB-IN
> F/lib/scala-compiler.jar,WEB-INF/lib/scalate-core-1.5.3.jar,WEB-INF/lib
> /scalate-util-1.5.3.jar,WEB-INF/lib/scalatra-2.1.1.jar,WEB-INF/lib/scal
> atra-scalate-2.1.1.jar,WEB-INF/lib/slf4j-api-1.6.5.jar,WEB-INF/lib/scal
> a-library.jar
> Tool: Bnd-1.50.0
> 
> 
> 
> 
> Here is the output of features:list -i
> 
> karaf@root> features:list -i
> State         Version           Name            Repository  Description
> [installed  ] [2.3.0          ] config          karaf-2.3.0 Provide OSGi
> ConfigAdmin support
> [installed  ] [7.6.7.v20120910] jetty           karaf-2.3.0 Provide Jetty
> engine support
> [installed  ] [2.3.0          ] http            karaf-2.3.0 Implementation
> of the OSGi HTTP service
> [installed  ] [2.3.0          ] http-whiteboard karaf-2.3.0 Provide HTTP
> Whiteboard pattern support
> [installed  ] [2.3.0          ] war             karaf-2.3.0 Turn Karaf as a
> full WebContainer
> [installed  ] [2.3.0          ] kar             karaf-2.3.0 Provide KAR
> (KARaf archive) support
> [installed  ] [2.3.0          ] ssh             karaf-2.3.0 Provide a SSHd
> server on Karaf
> [installed  ] [2.3.0          ] management      karaf-2.3.0 Provide a JMX
> MBeanServer and a set of MBeans in Karaf
> [installed  ] [2.9.2          ] scala-library   repo-0
> 
> 
> 
> --
> View this message in context: http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118p4027125.html
> Sent from the Karaf - User mailing list archive at Nabble.com.


Re: [2.3.0] Cannot start war system bundle

Posted by barnesjd <ba...@gmail.com>.
Hey JB, thanks for taking interest in my problem.  

BTW, if I do not include ServletContextListener as an import, I get a
ClassNotFoundException

Here is the contents of my manifest:

Manifest-Version: 1.0
Bnd-LastModified: 1355890216531
Bundle-ManifestVersion: 2
Bundle-Name: com.adtran.aoe.core.ui
Bundle-SymbolicName: com.adtran.aoe.core.ui
Bundle-Version: 0.1
Created-By: 1.6.0_25 (Sun Microsystems Inc.)
Import-Package:
org.osgi.framework;version="[1.5,2)",javax.servlet.ServletContextListener
Include-Resource: C:\aoe-modular\com.adtran.aoe.core.ui\src\main\resourc
 es,C:\aoe-modular\com.adtran.aoe.core.ui\src\main\py,C:\aoe-modular\com
 .adtran.aoe.core.ui\target\resource_managed\main
Private-Package: .
Web-ContextPath: helloworld
Webapp-Context: helloworld
Bundle-ClassPath: WEB-INF/classes,WEB-INF/lib/akka-actor-2.0.3.jar,WEB-I
 NF/lib/config-0.3.1.jar,WEB-INF/lib/grizzled-slf4j_2.9.2-0.6.9.jar,WEB-
 INF/lib/logback-classic-1.0.6.jar,WEB-INF/lib/logback-core-1.0.6.jar,WE
 B-INF/lib/org.osgi.core-4.3.0.jar,WEB-INF/lib/rl_2.9.2-0.3.2.jar,WEB-IN
 F/lib/scala-compiler.jar,WEB-INF/lib/scalate-core-1.5.3.jar,WEB-INF/lib
 /scalate-util-1.5.3.jar,WEB-INF/lib/scalatra-2.1.1.jar,WEB-INF/lib/scal
 atra-scalate-2.1.1.jar,WEB-INF/lib/slf4j-api-1.6.5.jar,WEB-INF/lib/scal
 a-library.jar
Tool: Bnd-1.50.0




Here is the output of features:list -i

karaf@root> features:list -i
State         Version           Name            Repository  Description
[installed  ] [2.3.0          ] config          karaf-2.3.0 Provide OSGi
ConfigAdmin support
[installed  ] [7.6.7.v20120910] jetty           karaf-2.3.0 Provide Jetty
engine support
[installed  ] [2.3.0          ] http            karaf-2.3.0 Implementation
of the OSGi HTTP service
[installed  ] [2.3.0          ] http-whiteboard karaf-2.3.0 Provide HTTP
Whiteboard pattern support
[installed  ] [2.3.0          ] war             karaf-2.3.0 Turn Karaf as a
full WebContainer
[installed  ] [2.3.0          ] kar             karaf-2.3.0 Provide KAR
(KARaf archive) support
[installed  ] [2.3.0          ] ssh             karaf-2.3.0 Provide a SSHd
server on Karaf
[installed  ] [2.3.0          ] management      karaf-2.3.0 Provide a JMX
MBeanServer and a set of MBeans in Karaf
[installed  ] [2.9.2          ] scala-library   repo-0



--
View this message in context: http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118p4027125.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [2.3.0] Cannot start war system bundle

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

could you share your WAB MANIFEST, especially the Import-Package ?

war is feature, not a bundle: the war feature installs Pax Web bundles 
in fact.
So better than osgi:list, you should do features:list -i to check if the 
feature is correctly installed.

Regards
JB

On 12/21/2012 04:59 PM, barnesjd wrote:
> Hey guys, I've been playing with a stand-alone Karaf 2.3.0 for a few weeks to
> figure out what OSGi is all about.  I've had a lot of success with it until
> recently while trying to deploy web archives.  I've created a hello-world
> wab with the appropriate manifest entries.  I also have installed the war
> system feature.  When I attempt to deploy my wab, it fails to resolve the
> 'javax.servlet.ServletContextListener' dependency.  I believe this is
> because the war feature isn't actually running.  Executing the osgi:list
> does not show war as a running bundle.  I can request it to start by running
> 'osgi:start war'; it asks me if I'm sure I want to start a system bundle to
> which I reply with 'yes'... but nothing seems to happen after that.
> Sometimes the prompt returns to me, sometimes it seems to just hang up.  I
> don't see the java process running hot or anything.
>
> Does anyone have an idea what I may be doing incorrectly?  Thanks in
> advance,
>
> Joe
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/2-3-0-Cannot-start-war-system-bundle-tp4027118.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