无法从Java应用程序

时间:2015-07-22 01:14:03

标签: java openstack openstack-swift cloud-storage

我正在尝试使用JOSS连接到对象存储。

这是我的连接代码:

    AccountConfig config = new AccountConfig();

    config.setUsername(USERNAME);
    config.setPassword(PASSWORD);

    config.setAuthUrl(AUTHURL);
    config.setTenantName(TenantName);

    Account account = new AccountFactory(config).createAccount();

但是我得到的例外情况如下所示。

请帮我解决这个问题。用Google搜索但很难找到解决方案。任何帮助赞赏。感谢。

注意:通过提供相同的凭据,AuthUrl,我能够从cloudberry等客户端连接到开放堆栈对象存储。

  

java.lang.NoSuchFieldError:UNWRAP_ROOT_VALUE at   org.javaswift.joss.command.impl.core.AbstractCommand.createObjectMapper(AbstractCommand.java:137)     在   org.javaswift.joss.command.impl.identity.KeystoneAuthenticationCommandImpl.setAuthenticationHeader(KeystoneAuthenticationCommandImpl.java:46)     在   org.javaswift.joss.command.impl.identity.KeystoneAuthenticationCommandImpl。(KeystoneAuthenticationCommandImpl.java:29)     在   org.javaswift.joss.command.impl.factory.AuthenticationCommandFactoryImpl.createAuthenticationCommand(AuthenticationCommandFactoryImpl.java:27)     在   org.javaswift.joss.client.impl.ClientImpl.createAccount(ClientImpl.java:84)     在   org.javaswift.joss.client.impl.ClientImpl.createAccount(ClientImpl.java:27)     在   org.javaswift.joss.client.core.AbstractClient.authenticate(AbstractClient.java:35)     在   org.javaswift.joss.client.factory.AccountFactory.createAccount(AccountFactory.java:30)     在   com.intel.vpg.avl.controller.AvlController.reports(AvlController.java:172)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:606)at   org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)     在   org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)     在   org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)     在   org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)     在   org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)     在   org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)     在   org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)     在   org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)     在   org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)     在   org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:624)at   javax.servlet.http.HttpServlet.service(HttpServlet.java:731)at at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)     在   org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:330)     在   org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)     在   org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)     在   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)     在   org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)     在   org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)     在   org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)     在   org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)     在   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)     在   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)     在   org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)     在   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)     在   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)     在   org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)     在   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)     在   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)     在   org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)     在   org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:620)     在   org.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run(JIoEndpoint.java:318)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:615)     在   org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)     在java.lang.Thread.run(Thread.java:745)

2 个答案:

答案 0 :(得分:0)

试试这段代码(对我有用):

AccountConfig config = new AccountConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthUrl(URL);
config.setAuthenticationMethod(AuthenticationMethod.BASIC);
Account account = new AccountFactory(config).createAccount();
Container container = account.getContainer("container-name");

答案 1 :(得分:0)

maven依赖冲突可能会导致此错误,请检查您对maven依赖关系org.codehaus.jackson,然后设置统一版本。我通过这种方法解决了这个错误,希望它能帮到你。