Java sample app : Working sample or not?

Highlighted
New Member

Java sample app : Working sample or not?

Does the sample code work or not?
I tried to launch the sample app locally, and ended up getting "HTTP Status 500" error message

The launch shows up the index.jsp. :http://localhost:8085/JavaSample/
On entering valid api-key,login and password - I get AbderaClient class not found error !

Tomcat Log attached:
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.(MultiThreadedHttpConnectionManager.java:70)
org.apache.abdera.protocol.client.AbderaClient.(AbderaClient.java:106)
org.apache.abdera.protocol.client.AbderaClient.(AbderaClient.java:125)
com.constantcontact.webservices.sample.ListServlet.doPost(ListServlet.java:66)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
5 REPLIES 5
Highlighted
Occasional Participant

Need commons logging jar files

 


I got past this problem by downloading the apache commons logging jars into the tomcat bin directory.



C:\apache-tomcat-6.0.20\lib\commons-logging-1.1.1.jar

C:\apache-tomcat-6.0.20\lib\commons-logging-api-1.1.1.jar



I hit some other issues after that but I'll save those for another reply.



diane

Highlighted
Occasional Participant

More Issues With Java Sample

Is the URI in the Constants.java file correct: "http://api.f1.constantcontact.com" ?  I always get a ConnectException for a connection timed out.


It does return something if I change the URI to: "https://api.constantcontact.com".


 


By the way in the finally blocks in ListServlet.java and ListViewServlert.java you need to check if resp is null before calling release(). Otherwise the null pointer exception hides the real problem.


 


Thanks,


diane

Highlighted
Moderator

That URI is not correct.  I

That URI is not correct.  I will look at the Java example and see why that URI is still in there and have this example updated soon.  Your second URI< https://api.constantcontact.com, is the correct URI.


 


Thanks for reporting this!

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

Other changes

 


Dave,


 


Thanks. I would also suggest you fix the other two minor glitches. Add a note to the README.txt that says the commons logging jars (or jar) are required to be in the tomcat\lib directory. Adding the check for the null resp reference in the finally blocks before calling release() is an easy,  low risk change as well.


 


It's very frustrating when samples don't work as expected. It took me longer to get this going than it should.


 


Thanks again,


 


diane ramsey

Highlighted
Moderator

Hi Diane, Thanks for the

Hi Diane,




Thanks for the feedback.  I've brought it back to the developer of the Java application and we will hopefully have this updated shortly.  We do apologize for the frustration, we agree that the sample code we provide should be simple and work correctly without heavy modification.


 


 

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured