1

我正在使用此处给出的相同示例将我的文件上传到 Azure blob。当我将它作为纯 Java 项目代码运行时,它工作正常,但是当我从中创建一个 OSGi 包并尝试同样的事情时,我得到了以下异常。

2013-09-28 14:05:11,578[qtp26511982-145]|ERROR|<my_package>.fileupload.service.uploadservice.impl.UploadServiceAzureProcess|IOException java.util.NoSuchElementException: key [azureblob] not in the
list of providers or apis: {apis=[transient]}
java.util.NoSuchElementException: key [azureblob] not in the list of providers or apis: {apis=[transient]}
        at org.jclouds.ContextBuilder.newBuilder(ContextBuilder.java:178)
        at <my_package>.fileupload.service.uploadservice.impl.UploadServiceAzureProcess.uploadFileWithDetails(UploadServiceAzureProcess.java:99)
        at <my_package>.fileupload.service.uploadservice.impl.UploadServiceImpl.uploadCaseFiles(UploadServiceImpl.java:113)
        at <my_package>.fileupload.service.uploadservice.impl.UploadServiceImpl.uploadFile(UploadServiceImpl.java:80)
        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:601)
        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:102)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:355)
        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:319)
        at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1040)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:976)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:363)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
        at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:196)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:722)

有人可以帮我吗?

4

1 回答 1

0

这是因为您可能在应用程序类路径中没有azureblob依赖项。确保您的pom.xml文件中有此依赖项:

<dependency>
    <groupId>org.apache.jclouds.provider</groupId>
    <artifactId>azureblob</artifactId>
    <version>${jclouds.version}</version>
</dependency>

查看故障排除指南以获取有关此错误的更多信息。

于 2014-07-16T08:10:30.307 回答