Hello, i'm trying to create a servlet using Blueprint and register it to
Pax-web using the whiteboard pattern but i'm having some trouble. 

I've followed the sample at
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/whiteboard-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml
, but it seems that the pax-web is failing to register the context. 

Here's the logs: 

2017-04-04 16:09:28,135 | INFO  | nsole user karaf | RotinaServlet              
     
| 102 - br.com.pcsist.winthor.core.winthor-core-servico - 1.3.0.SNAPSHOT |
Servlet registrado no contexto '/852'
2017-04-04 16:09:28,136 | INFO  | nsole user karaf | HttpServiceFactoryImpl     
     
| 64 - org.ops4j.pax.web.pax-web-runtime - 4.3.0 | Binding bundle:
[br.com.pcsist.winthor.rotina.winthor-fer-0852 [180]] to http service
2017-04-04 16:09:28,142 | INFO  | nsole user karaf | JettyServerWrapper         
     
| 63 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | will add
org.apache.jasper.servlet.JasperInitializer to ServletContainerInitializers
2017-04-04 16:09:28,142 | INFO  | nsole user karaf | JettyServerWrapper         
     
| 63 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | Skipt
org.apache.jasper.servlet.JasperInitializer, because specialized handler
will be present
2017-04-04 16:09:28,142 | INFO  | nsole user karaf | JettyServerWrapper         
     
| 63 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | will add
org.springframework.web.SpringServletContainerInitializer to
ServletContainerInitializers
2017-04-04 16:09:28,143 | WARN  | nsole user karaf | JettyServerWrapper         
     
| 63 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | failed to parse and
instantiate of javax.servlet.ServletContainerInitializer in classpath
2017-04-04 16:09:28,143 | INFO  | nsole user karaf | JettyServerWrapper         
     
| 63 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | will add
org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer
to ServletContainerInitializers
2017-04-04 16:09:28,161 | INFO  | nsole user karaf | JettyServerWrapper         
     
| 63 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | added
ServletContainerInitializer:
org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer
2017-04-04 16:09:28,162 | INFO  | nsole user karaf | HttpServiceContext         
     
| 63 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | registering context
DefaultHttpContext [bundle=br.com.pcsist.winthor.rotina.winthor-fer-0852
[180], contextID=default], with context-name:
2017-04-04 16:09:28,163 | INFO  | nsole user karaf | HttpServiceContext         
     
| 63 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | registering
JasperInitializer
2017-04-04 16:09:28,184 | INFO  | nsole user karaf | ContextHandler             
     
| 50 - org.eclipse.jetty.util - 9.2.19.v20160908 | Started
HttpServiceContext{httpContext=DefaultHttpContext
[bundle=br.com.pcsist.winthor.rotina.winthor-fer-0852 [180],
contextID=default]}

And my blueprint.xml

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";>

  <bean id="rotinaServlet"
class="br.com.pcsist.winthor.core.servico.RotinaServlet">
    <argument type="java.lang.String" value="/852" />
  </bean>

  <service id="rotinaServletService" ref="rotinaServlet"
interface="javax.servlet.Servlet">
    <service-properties>
      <entry key="alias" value="/852" />
      <entry key="servlet-name" value="Rotina 852" />
    </service-properties>
  </service>

</blueprint>

The servlet is getting instantiated, without any problem, but it seems that
the context is not getting mapped to /852 , since i can't see it in web:list 

And here: org.ops4j.pax.web.pax-web-jetty - 4.3.0 | registering context
DefaultHttpContext [bundle=br.com.pcsist.winthor.rotina.winthor-fer-0852
[180], contextID=default], with context-name: 

i don't see my context in contextName. 

What i am doing wrong?




--
View this message in context: 
http://karaf.922171.n3.nabble.com/Blueprint-and-Pax-Web-tp4050033.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to