+ Start a Discussion
manjirimanjiri 

Problem in java servlet example - Force.com for Google App Engine for Java: Getting Started

 Hi,

 

I am using following link for trying Google App integration withn Salesforce.

 

http://wiki.developerforce.com/index.php/Force.com_for_Google_App_Engine_Setup_Guide_Java

 

After putting the jars "partner-library.jar ", "wsc-16_0.jar" and "wsc-gae-16_0.jar" in lib path, I have tried to run the servlet "HttpServlet"same code given in the above link.

 

While runningthe servlet I have got following version related error. I am using jdk1.5.0_16

 

Error 500

Bad version number in .class file

RequestURI=/helloSalesforceUser

Caused by:

java.lang.UnsupportedClassVersionError: Bad version number in .class file
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$100(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:142)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
	at java.lang.Class.getConstructor0(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
	at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
	at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
	at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:54)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
	at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:306)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
	at org.mortbay.jetty.Server.handle(Server.java:313)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
	at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)

 

 

 So how can I resolve this. Do I need to use jdk1.6 only?

 

RyanGuestRyanGuest
Yes, you generally can't use compiled classes from newer JDK versions. 
manjirimanjiri

Thanks Ryan for the reply.

 

Now I am using Java 6

I am able to run sample java Partner client program "PartnerClient.java" using Run As Java Application option, I am getting proper connection to salesforce.


But same account credentials I am giving for  HelloWorldServlet.java  servlet and trying to run it as web appliction

 

But it it not making connection to salesforce given follwing Exception

 

java.lang.UnsupportedOperationException: Method not implemented.
    at java.net.URLStreamHandler.openConnection(URLStreamHandler.java:80)
    at java.net.URL.openConnection(URL.java:992)
    at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:80)
    at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:70)
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:99)
    at com.sforce.soap.partner.PartnerConnection.login(PartnerConnection.java:754)
    at com.sforce.soap.partner.PartnerConnection.<init>(PartnerConnection.java:294)
    at com.sforce.soap.partner.Connector.newConnection(Connector.java:27)
    at guestbook.HelloWorldServlet.getConnection(HelloWorldServlet.java:91)
    at guestbook.HelloWorldServlet.doGet(HelloWorldServlet.java:25)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:54)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:306)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at org.mortbay.jetty.Server.handle(Server.java:313)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
    at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
 

 So is there any setting remaining which might be causing the problem ?

 I have put the three required jars in the lib "partner-library.jar","wsc-16_0.jar","wsc-gae-16_0.jar" path.

 

If anyone knows the solution please help.

 

 

DSaravanaDSaravana
Remove wsc-16_0.jar from the classpath. It should work
manjirimanjiri

Hi,

 

Thanks for the reply. I will try out this.