AWS JAVA SDK - java.lang.NoClassDefFoundError

1,105 views
Skip to first unread message

idtDev01

unread,
Mar 25, 2014, 6:29:42 PM3/25/14
to ra...@googlegroups.com
I'm new to calling java objects from railo, but I believe that these few lines of code should work:

<cfset cred = createObject("java","com.amazonaws.auth.BasicAWSCredentials").init(application.s3accessKeyid,application.s3SecretKey) />
<cfset client = createObject("java","com.amazonaws.services.s3.AmazonS3Client").init(cred) />

The cred object works fine, but when the client object gets created, i get the following error:

java.lang.NoClassDefFoundError
org/apache/http/impl/conn/PoolingClientConnectionManager

I have put the aws sdk jar file into the [home]/lib path as instructed at the link below but i can't seem to get around this error:

Could one of the local guru's point me in the right direction?

Michael Offner

unread,
Mar 26, 2014, 3:06:24 AM3/26/14
to ra...@googlegroups.com
Without digging (using a mobile device ATM), there are 2 reasons for this exception
1. The jar where the class "PoolingClientConnectionManager" is in is not loaded because it is not in the class path (maybe you need a addional jar)
2. The jar is in conflict with a jar already present in the class path that contains the same classes in a different version. 

I know this 2 options are very theoretical, but the problem is for sure one of them.
Micha

--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/1b56b3c1-07f7-42ad-b1b3-2a0305ad31bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
/micha

Michael Offner CTO Railo Technologies GmbH

idtDev01

unread,
Mar 27, 2014, 4:28:08 PM3/27/14
to ra...@googlegroups.com
Thanks for the reply Micha, that did lead me in the right direction.  There are some third party jars that are included in the sdk in a "Third Party" folder that i wasn't adding.  However when I added the dependencies, i was still getting the following error:

java.lang.NoSuchMethodError
org.apache.http.impl.conn.DefaultClientConnectionOperator.<init>(Lorg/apache/http/conn/scheme/SchemeRegistry;Lorg/apache/http/conn/DnsResolver;)V

It looks like railo 4.1.1.00 was using an older version of the apache httpclient that was conflicting with the newest aws sdk.  I upgraded to Railo 4.1.2.005 final and it's working now.

Thanks again Micha!
Reply all
Reply to author
Forward
0 new messages