2012-04-13 52 views
1

我似乎能夠連接正常,因爲新的RestS3Service不會引發異常。JetS3t - 無一例外地連接,但當我嘗試做其他任何事情時「無效的類名」

然而,當我試圖做類似getBucket( 「名稱」),然後我得到:無效的類名: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 

回答

1

它看起來像org.jets3t.service.utils.RestUtils $ ConnManagerFactory.class從您的類路徑中失蹤。你有整個JetS3t庫嗎?庫中大約有19個罐子,RestUtils $ ConnManagerFactory.class在0.8.1a版本的jet3t-0.8.1a.jar中。

+0

我讓他們在我的構建類路徑,但不是我的運行類路徑。這是問題。將您的答案標記爲已接受。謝謝。 – 2012-04-20 00:00:05

1

Groovy的用戶:此異常也被拋出,如果您聲明的JetS3t作爲一個Groovy腳本葡萄的依賴。

如果您遇到這種情況,你需要葡萄配置爲使用系統類加載器:

@GrabConfig(systemClassLoader=true) 
@Grab(group='net.java.dev.jets3t', module='jets3t', version='0.9.4') 
相關問題