我似乎能够正常连接,因为新的RestS3Service 不会抛出异常。
但是,当我尝试执行 getBucket(“name”)之类的操作时,我得到:无效的类名:org.jets3t.service.utils.RestUtils $ ConnManagerFactory
知道如何解决这个问题吗?
谢谢!
我的代码:
AWSCredentials awsCredentials = new AWSCredentials(awsAccessKey, awsSecretKey);
S3Service s3Service = null;
System.out.println("Credentials created, trying Service");
try {
s3Service = new RestS3Service(awsCredentials);
} catch (S3ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Service connected, trying bucket grab");
try {
S3Bucket bucket = s3Service.getBucket("mrbucket");
System.out.println("bucket grabbed: "+bucket.getName());
} catch (S3ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
输出:
Credentials created, trying Service
Installer - Installer service created
Service connected, trying bucket grab
org.jets3t.service.S3ServiceException: Request Error: java.lang.IllegalStateException: Invalid class name: org.jets3t.service.utils.RestUtils$ConnManagerFactory
at org.jets3t.service.S3Service.getBucket(S3Service.java:1911)
at org.red5.core.Application.myFunction(Application.java:78)
at org.red5.core.Application.appStart(Application.java:42)
at org.red5.server.adapter.MultiThreadedApplicationAdapter.start(MultiThreadedApplicationAdapter.java:408)
at org.red5.server.adapter.ApplicationAdapter.start(ApplicationAdapter.java:54)
at org.red5.server.Scope.start(Scope.java:1170)
at org.red5.server.Scope.init(Scope.java:905)
at org.red5.server.WebScope.register(WebScope.java:207)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:577)
Caused by: java.lang.IllegalStateException: Invalid class name: org.jets3t.service.utils.RestUtils$ConnManagerFactory
at org.apache.http.impl.client.AbstractHttpClient.createClientConnectionManager(AbstractHttpClient.java:308)
at org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(AbstractHttpClient.java:445)
at org.apache.http.impl.client.AbstractHttpClient.createHttpContext(AbstractHttpClient.java:274)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:797)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.performRequest(RestStorageService.java:334)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.performRequest(RestStorageService.java:281)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.performRestGet(RestStorageService.java:981)
at org.jets3t.service.impl.rest.httpclient.RestStorageService.listAllBucketsImpl(RestStorageService.java:1373)
at org.jets3t.service.StorageService.listAllBucketsImpl(StorageService.java:1379)
at org.jets3t.service.StorageService.listAllBuckets(StorageService.java:563)
at org.jets3t.service.S3Service.listAllBuckets(S3Service.java:1367)
at org.jets3t.service.S3Service.listAllBuckets(S3Service.java:84)
at org.jets3t.service.StorageService.getBucket(StorageService.java:729)
at org.jets3t.service.S3Service.getBucket(S3Service.java:1909)
... 24 more
答案 0 :(得分:1)
看起来类路径中缺少org.jets3t.service.utils.RestUtils $ ConnManagerFactory.class。你有整个JetS3t库吗?库中有大约19个罐子,RestUtils $ ConnManagerFactory.class位于0.8.1a版本的jet3t-0.8.1a.jar中。
答案 1 :(得分:1)
Groovy用户:如果您在 Grape 的groovy脚本中将 jets3t 声明为依赖项,则也会抛出此异常。
如果是这种情况,您需要配置Grape以使用系统类加载器:
@GrabConfig(systemClassLoader=true)
@Grab(group='net.java.dev.jets3t', module='jets3t', version='0.9.4')