Apache Karaf bundles not working after internet restart

时间:2016-04-15 14:51:59

标签: java web-services osgi axis2 apache-karaf

I am using Apache Karaf and some of my bundles use Axis2 for webservices. The bundles work fine when the internet is connected but once the internet gets disconnected the webservice call fails which is natural.

But once the internet is back and when the bundle tries to do a webservice call it still fails telling that the internet is not available.

The webservice doesnt work even if I restart the bundles. And then if I restart karaf the webservices start working correctly.

The error which is logged is

 Exception in thread "Timeout guard" java.lang.NoClassDefFoundError: javax/net/SocketFactory
    at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:82)
    at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1.doit(ControllerThreadSocketFactory.java:91)
    at org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$SocketTask.run(ControllerThreadSocketFactory.java:158)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: javax.net.SocketFactory not found by com.globalhealth.referralnet.agent.rna-server-proxy [19293]
    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:357)

This is the stack trace:

java.lang.NullPointerException
    at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:721)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:396)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:223)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)[19293:xyz:1.0.0.SNAPSHOT]
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)[19293:xyz:1.0.0.SNAPSHOT]

Any insights on this would be really helpful.

1 个答案:

答案 0 :(得分:0)

这是轴束中的包导入问题。 我在轴捆绑中导入了javax.net。*,问题得到了解决。