John
John

Reputation: 203

Karaf post request fails with javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/oro/text/regex/MalformedPatternException

Hi I have deployed a webservice bundle successfullly in karaf. When i post a request i am getting the below error. javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/oro/text/regex/MalformedPatternException Karaf is not able to find this jar in runtime. But when i do a list it show this jar is installed and active.

@Path("/postStudy")
public class postStudy {
    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response sayHtmlHello(String uriInfo) throws IOException {
        ClientSSH ssh = new ClientSSH ("ttest", "admin","password");
        return Response.status(200).build();
    }
}

I am using MalformedPatternException inside the ClientSSH class. Exception is thrown while loadinh clientSSH

Feature.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="NHandler">
    <feature name="NHandler" description="NHandler Jersey Webapp" version="0.0.1.SNAPSHOT">
        <feature prerequisite="true" dependency="false">wrap</feature>
        <bundle>mvn:NHandler/NHandler/0.0.1-SNAPSHOT</bundle>
        <bundle>mvn:org.slf4j/slf4j-simple/1.7.12</bundle>
        <bundle>mvn:org.slf4j/slf4j-api/1.7.12</bundle>
        <bundle>mvn:com.sun.jersey/jersey-core/1.19</bundle>
        <bundle>mvn:com.sun.jersey/jersey-server/1.19</bundle>
        <bundle>mvn:com.sun.jersey/jersey-servlet/1.19</bundle>
        <bundle>wrap:mvn:com.google.com.p.expect4j/expect4j/1.0</bundle>
        <bundle>wrap:mvn:oro/oro/2.0.8</bundle>
        <bundle>wrap:mvn:com.jcraft/jsch/0.1.53</bundle>
        <bundle>mvn:javax.ws.rs/jsr311-api/1.1.1</bundle>
    </feature>
</features>

I was able to successfully deploy my webbundle in karaf as well as post the request.

Exception Thrown

javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/oro/text/regex/MalformedPatternException
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:271)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:497)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/apache/oro/text/regex/MalformedPatternException
    at com.bt.cloud.implementation.AutoConfigure.&lt;init&gt;(AutoConfigure.java:19)
    at com.bt.expectrs.PostConfigs.postPlainURL(PostConfigs.java:91)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
    ... 24 more
Caused by: java.lang.ClassNotFoundException: org.apache.oro.text.regex.MalformedPatternException not found by NHandler [96]
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

Upvotes: 0

Views: 447

Answers (1)

vetalok
vetalok

Reputation: 173

Where NetworkHandler is located? Did you try to edit MANIFEST.MF by adding import of org/apache/oro/text/regex?

Upvotes: 0

Related Questions