Friday, January 1, 2010

Re: Error in JDBC call

Abhay,

As Sripathi Krishnan pointed out in his reply, I also find it hard to
believe you´d run into that trouble just because of a missing JAR.

I had a similar issue with my mysql connection when updating to GWT
2.0, though my error message was slightly different (it indicated some
sort of lack of JDBC security privileges when Jetty was trying to
access the database).

As mr.Krishnan suggested, I also got my application back to normal by
switching off the Google App Engine (at Eclipse, right-click at the
project, Google> App Engine Settings, disable checkbox). I consider
this a workaround, since I do not fully understand what caused the
issue. By searching this group you will see that other people ran
into similar issues and also avoided them in that same way.

Please keep us informed of your progress.

Thanks,
Marco


On Dec 31 2009, 5:09 am, Abhay Singh <abhay.asi...@gmail.com> wrote:
> Hi
>
> I am trying to connect Mysql database but getting this error(DB part
> is in server side code, which get invoked through RPC)
>
> The server is running athttp://localhost:8080/
> Call Failed
> Dec 31, 2009 7:07:16 AM com.google.apphosting.utils.jetty.JettyLogger
> warn
> WARNING: Nested in javax.servlet.ServletException: init:
> java.lang.NoClassDefFoundError: com/mysql/jdbc/Connection
>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>         at java.lang.Class.getConstructor0(Class.java:2671)
>         at java.lang.Class.newInstance0(Class.java:321)
>         at java.lang.Class.newInstance(Class.java:303)
>         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 com.google.appengine.tools.development.StaticFileFilter.doFilter
> (StaticFileFilter.java:121)
>         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:313)
>         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.content
> (HttpConnection.java:844)
>         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
>         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)
> Dec 31, 2009 7:07:16 AM com.google.apphosting.utils.jetty.JettyLogger
> warn
> WARNING: /sample/greet
> java.lang.NoClassDefFoundError: com/mysql/jdbc/Connection
>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>         at java.lang.Class.getConstructor0(Class.java:2671)
>         at java.lang.Class.newInstance0(Class.java:321)
>         at java.lang.Class.newInstance(Class.java:303)
>         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 com.google.appengine.tools.development.StaticFileFilter.doFilter
> (StaticFileFilter.java:121)
>         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:313)
>         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.content
> (HttpConnection.java:844)
>         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
>         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)
>
> here is my function to connect db...
> import java.sql.SQLException;
> import sample.client.GreetingService;
> import com.google.gwt.user.server.rpc.RemoteServiceServlet;
> import com.mysql.jdbc.Connection;
> import com.mysql.jdbc.ResultSet;
> import com.mysql.jdbc.Statement;
>
> @SuppressWarnings("serial")
> public class GreetingServiceImpl extends RemoteServiceServlet
> implements GreetingService {
> public String[] Getdata(){
>                 String[] location = null;
>                 String query = "Select ge_cntry from mst_geo where
> ge_zone='AFRICA'";
>                 int ix=0;
>
>                 System.out.println("In Getdata Funtion");
>                 try{
>                         Connection conn = DBUtils.getConn();
>                         Statement select = (Statement) conn.createStatement();
>                     ResultSet result = (ResultSet) select.executeQuery(query);
>                     while (result.next()) {
>                         location[ix++] = result.getString(1);
>                     }
>                     select.close();
>                     result.close();
>                     conn.close();
>                 }catch(SQLException e){
>                         System.err.println("Mysql Statement Error: " + query);
>                         e.printStackTrace();
>                 }
>                 return location;
>         }
>
> }
>
> what is wrong here?

--

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate