a strange problem, about Bundle-Classpath[Jar:dot]

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

a strange problem, about Bundle-Classpath[Jar:dot]

stream
As subject. i use spring with spring-dm, and buliding with Maven Bnd plugin.

then show the below Error
[ERROR] Error building bundle cn.shopex:HelloWeb:bundle:0.0.1-SNAPSHOT : Unresolved references to [org.springframework.beans.factory] by class(es) on
the Bundle-Classpath[Jar:dot]: [cn/shopex/HelloWeb/HelloWorldServlet.class]

but, if i comment the code that about the spring, all to be ok~

HelloWorldServlet.java
<pre>
public class HelloWorldServlet extends HttpServlet{

    private static final long serialVersionUID = -6421103301902391763L;
   
    /* (non-Javadoc)
     */
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        sendResponse(req, resp);
    }

    /* (non-Javadoc)
     */
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
        sendResponse(req, resp);
    }

    private void sendResponse(HttpServletRequest req, HttpServletResponse response) throws IOException {
        response.setContentType("text/html");
        ServletOutputStream out = response.getOutputStream();
        out.println("<html>");
        out.println("<head><title>HelloWorld</title></head>");
        out.println("<body>");
        out.println("Hello World!<BR>");

  //      WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(req.getSession().getServletContext());
  //      TimeService timeService = (TimeService)ctx.getBean("osgiTimeService");


        out.println("Current time is " + timeService.getCurrentTime());
        out.println("</body></html>");
    }
   
}
</pre>
are there anyone come across this issue.
thanks



Reply | Threaded
Open this post in threaded view
|

Re: a strange problem, about Bundle-Classpath[Jar:dot]

Andreas Pieber
Hey,

Can you please attach your pom? (if it's multimodule please also
include the one where you've configured the mvn bundle plugin)

Kind regards,
Andreas

On Mon, Mar 14, 2011 at 12:04 PM, stream <[hidden email]> wrote:

> As subject. i use spring with spring-dm, and buliding with Maven Bnd plugin.
>
> then show the below Error
> [ERROR] Error building bundle cn.shopex:HelloWeb:bundle:0.0.1-SNAPSHOT :
> Unresolved references to [org.springframework.beans.factory] by class(es) on
> the Bundle-Classpath[Jar:dot]: [cn/shopex/HelloWeb/HelloWorldServlet.class]
>
> but, if i comment the code that about the spring, all to be ok~
>
> HelloWorldServlet.java
>
> public class HelloWorldServlet extends HttpServlet{
>
>    private static final long serialVersionUID = -6421103301902391763L;
>
>    /* (non-Javadoc)
>     */
>    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
>            throws ServletException, IOException {
>        sendResponse(req, resp);
>    }
>
>    /* (non-Javadoc)
>     */
>    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
>        throws ServletException, IOException {
>        sendResponse(req, resp);
>    }
>
>    private void sendResponse(HttpServletRequest req, HttpServletResponse
> response) throws IOException {
>        response.setContentType("text/html");
>        ServletOutputStream out = response.getOutputStream();
>        out.println("");
>        out.println("HelloWorld");
>        out.println("");
>        out.println("Hello World!
> ");
>
>  //      WebApplicationContext ctx =
> WebApplicationContextUtils.getWebApplicationContext(req.getSession().getServletContext());
>  //      TimeService timeService =
> (TimeService)ctx.getBean("osgiTimeService");
>
>        out.println("Current time is " + timeService.getCurrentTime());
>        out.println("");
>    }
>
> }
>
> are there anyone come across this issue.
> thanks
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/a-strange-problem-about-Bundle-Classpath-Jar-dot-tp2675766p2675766.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: a strange problem, about Bundle-Classpath[Jar:dot]

mikevan
In reply to this post by stream
stream wrote
As subject. i use spring with spring-dm, and buliding with Maven Bnd plugin.

then show the below Error
[ERROR] Error building bundle cn.shopex:HelloWeb:bundle:0.0.1-SNAPSHOT : Unresolved references to [org.springframework.beans.factory] by class(es) on
the Bundle-Classpath[Jar:dot]: [cn/shopex/HelloWeb/HelloWorldServlet.class]
Stream, are you using maven or ant to build?
Reply | Threaded
Open this post in threaded view
|

Re: a strange problem, about Bundle-Classpath[Jar:dot]

stream
Yes, i used maven and its plugin Bnd to build...
by the way ,put my pom.xml that maybe could not to running, for lack of some bundle...

did you know any information. thanks

pom.xml
Reply | Threaded
Open this post in threaded view
|

Re: a strange problem, about Bundle-Classpath[Jar:dot]

stream
Hi. everyone
the problem has been resolve, i've changed file of pom.xml.

<Import-Package>
        javax.servlet;version="2.4.0",
        javax.servlet.http;version="2.4.0",
        org.osgi.framework;version="1.5.0",
        cn.shopex.TimeService,
        org.springframework.beans,
        org.springframework.beans.factory,
        org.springframework.osgi.web.context.support,
        org.springframework.web.context,
        org.springframework.web.context.support
</Import-Package>
note the bold font.

but there is an anthoer problem, but not serious.
i've deployed jar to folder of deploy, and could running well. but the error is still displaying in the file of log.

i've uploaded the files, guys could run it in your karaf 2.2.0
and then open your web browser and point to http://localhost:8181/HelloWeb/hello
but the error has exist while you startup your karaf.

Could not start the servlet context for http context [org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext@742397]
java.lang.NullPointerException
        at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.addContext(JettyServerWrapper.java:209)[61:org.ops4j.pax.web.pax-web-jetty:1.0.1]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.getOrCreateContext(JettyServerWrapper.java:112)[61:org.ops4j.pax.web.pax-web-jetty:1.0.1]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerImpl.addServlet(JettyServerImpl.java:137)[61:org.ops4j.pax.web.pax-web-jetty:1.0.1]
        at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl$Started.addServlet(ServerControllerImpl.java:266)[61:org.ops4j.pax.web.pax-web-jetty:1.0.1]
        at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl.addServlet(ServerControllerImpl.java:107)[61:org.ops4j.pax.web.pax-web-jetty:1.0.1]
        at org.ops4j.pax.web.service.internal.HttpServiceStarted.registerResources(HttpServiceStarted.java:180)[60:org.ops4j.pax.web.pax-web-runtime:1.0.1]
        at org.ops4j.pax.web.service.internal.HttpServiceProxy.registerResources(HttpServiceProxy.java:66)[60:org.ops4j.pax.web.pax-web-runtime:1.0.1]
        at org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC.visit(RegisterWebAppVisitorWC.java:138)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.web.extender.war.internal.model.WebApp.accept(WebApp.java:558)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.register(WebAppPublisher.java:170)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.serviceChanged(WebAppPublisher.java:155)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher$HttpServiceListener.serviceChanged(WebAppPublisher.java:119)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.tracker.ReplaceableService.setService(ReplaceableService.java:114)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.tracker.ReplaceableService.access$100(ReplaceableService.java:28)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.tracker.ReplaceableService$CollectionListener.serviceAdded(ReplaceableService.java:183)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.tracker.ServiceCollection$Tracker.addingService(ServiceCollection.java:181)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)[karaf.jar:]
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)[karaf.jar:]
        at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)[karaf.jar:]
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:339)[karaf.jar:]
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)[karaf.jar:]
        at org.ops4j.pax.swissbox.tracker.ServiceCollection.onStart(ServiceCollection.java:139)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle$Stopped.start(AbstractLifecycle.java:121)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle.start(AbstractLifecycle.java:49)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.tracker.ReplaceableService.onStart(ReplaceableService.java:146)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle$Stopped.start(AbstractLifecycle.java:121)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.lifecycle.AbstractLifecycle.start(AbstractLifecycle.java:49)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.web.extender.war.internal.WebAppPublisher.publish(WebAppPublisher.java:81)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.doPublish(WebXmlObserver.java:300)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.web.extender.war.internal.WebXmlObserver.addingEntries(WebXmlObserver.java:153)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.extender.BundleWatcher.register(BundleWatcher.java:186)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.extender.BundleWatcher.access$000(BundleWatcher.java:45)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.ops4j.pax.swissbox.extender.BundleWatcher$1.bundleChanged(BundleWatcher.java:127)[72:org.ops4j.pax.web.pax-web-extender-war:1.0.1]
        at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)[org.apache.felix.framework-3.0.8.jar:]
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)[org.apache.felix.framework-3.0.8.jar:]
        at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)[org.apache.felix.framework-3.0.8.jar:]
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3758)[org.apache.felix.framework-3.0.8.jar:]
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1780)[org.apache.felix.framework-3.0.8.jar:]
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:922)[org.apache.felix.framework-3.0.8.jar:]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1175)[6:org.apache.felix.fileinstall:3.1.10]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1153)[6:org.apache.felix.fileinstall:3.1.10]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.processAllBundles(DirectoryWatcher.java:1146)[6:org.apache.felix.fileinstall:3.1.10]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:456)[6:org.apache.felix.fileinstall:3.1.10]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:263)[6:org.apache.felix.fileinstall:3.1.10]
14:19:34,750 | INFO  | raf-2.2.0/deploy | /HelloWeb                        | .eclipse.jetty.util.log.Slf4jLog   55 | 50 - org.eclipse.jetty.util - 7.2.2.v20101205 | Initializing Spring root WebApplicationContext


someone could give me a suggestion




karaf.logdeploy.zip