problem solved! Thanks!

On Jun 20, 1:00 pm, Enea <[email protected]> wrote:
> hm... I had similar problem with jdbc...
>
> if you are using eclipse,
> try to go under Project->properties->google->App Engine
> and disable "Use Google App Engine" checkbox .
>
> regards :)
>
> On 20 Giu, 02:00, Petein <[email protected]> wrote:
>
>
>
> > package faceRecognition.server;
>
> > import faceRecognition.client.AuthService;
> > import com.google.gwt.user.server.rpc.RemoteServiceServlet;
>
> > import java.sql.*;
> > import java.util.*;
> > import java.text.SimpleDateFormat;
>
> > /**
> >  * The server side implementation of the RPC service.
> >  */
> > @SuppressWarnings("serial")
> > public class AuthServiceImpl extends RemoteServiceServlet implements
> >                 AuthService {
>
> >         public String doAuthenticate(String name, String surname,
> >                         String username, String password,
> >                         String email, String info){
>
> >                 String serverInfo = getServletContext().getServerInfo();
> >                 String userAgent = 
> > getThreadLocalRequest().getHeader("User-Agent");
>
> >                 //jdbc part
>
> >                 /*
> >                 Connection con = null;
> >         try {
>
> >           Class.forName("com.mysql.jdbc.Driver").newInstance();
>
> >             //out.println("<br>driver is ok");
>
> >             String url = "jdbc:mysql://" + "localhost" + "/" +
> > "USERSDB" + "?";
> >             String usernamedb = "root";
> >             String passworddb = "";
> >             con = (Connection) DriverManager.getConnection(url,
> > usernamedb, passworddb);
>
> >             Statement st = con.createStatement();
> >             ResultSet rs;
>
> >            rs = st.executeQuery("SELECT username, password FROM
> > users");
>
> >             boolean found = false;
>
> >             while (rs.next()) {
> >                 usernamedb = rs.getString(1);
> >                 passworddb = rs.getString(2);
>
> >                 if (usernamedb.equals(username)) {
> >                     found = true;
> >                     break;
> >                 }
> >             }
>
> >             if (!found){
>
> >                         password = " a";
> >                 //create user
>
> >                 String sql = "INSERT INTO testusers(name, username,
> > password, info) VALUES(?, ?, ?, ?)";
>
> >                 PreparedStatement pstmt = con.prepareStatement(sql);
>
> >                 // Set the values
> >                 pstmt.setString(1, name);
> >                 pstmt.setString(2, username);
> >                 pstmt.setString(3, password);
> >                 pstmt.setString(4, info);
>
> >                 //Calendar calendar = new GregorianCalendar(); String
> > time = calendar.getTime().toString();  //Thu Jun 11 02:30:10 EEST 2009
>
> >                 //String time = new GregorianCalendar().getTime
> > ().toString();
>
> >                 //pstmt.setString(5, time);
>
> >                 pstmt.execute();
>
> >             }
>
> >         }catch(ClassNotFoundException cnfe){
> >                 return(cnfe.toString());
> >         } catch(SQLException sqle){
> >                 return(sqle.toString());
> >         } catch(InstantiationException ie){
> >                 return(ie.toString());
> >         }catch (IllegalAccessException iae) {
> >                         return(iae.toString());
> >                 }
>
> >             */
>
> >                 return "Hello, " + name +  " " + surname + "!<br><br>Server 
> > info: "
> > + serverInfo
> >                                 + ".<br><br>Using:<br>" + userAgent + " 
> > Your request was sent!";
> >         }
>
> > }
>
> > when this part of code is executed without the jdbc part it executes
> > fine and the RPC method works ok.
> > When i execute the code as it is above i get these errors:
> > The server is running athttp://localhost:1598/
> > 19 &#921;&#959;&#965;&#957; 2009 11:33:32 &#956;&#956;
> > com.google.appengine.tools.development.ApiProxyLocalImpl log
> > SEVERE: [1245454412421000] javax.servlet.ServletContext log: Exception
> > while dispatching incoming RPC call
> > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > 'public abstract java.lang.String
> > faceRecognition.client.AuthService.doAuthenticate
> > (java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.l 
> > ang.String,java.lang.String)'
> > threw an unexpected exception: java.lang.ExceptionInInitializerError
> >         at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
> > (RPC.java:360)
> >         at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
> > (RPC.java:546)
> >         at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
> > (RemoteServiceServlet.java:166)
> >         at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
> > (RemoteServiceServlet.java:86)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
> >         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.content
> > (HttpConnection.java:844)
> >         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
> >         at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
> >         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)
> > Caused by: java.lang.ExceptionInInitializerError
> >         at com.mysql.jdbc.NonRegisteringDriver.connect
> > (NonRegisteringDriver.java:282)
> >         at java.sql.DriverManager.getConnection(DriverManager.java:582)
> >         at java.sql.DriverManager.getConnection(DriverManager.java:185)
> >         at faceRecognition.server.AuthServiceImpl.doAuthenticate
> > (AuthServiceImpl.java:37)
> >         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 com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
> > (RPC.java:527)
> >         ... 25 more
> > Caused by: java.security.AccessControlException: access denied
> > (java.lang.RuntimePermission modifyThreadGroup)
> >         at java.security.AccessControlContext.checkPermission
> > (AccessControlContext.java:323)
> >         at java.security.AccessController.checkPermission
> > (AccessController.java:546)
> >         at java.lang.SecurityManager.checkPermission(SecurityManager.java:
> > 532)
> >         at com.google.appengine.tools.development.DevAppServerFactory
> > $CustomSecurityManager.checkPermission(DevAppServerFactory.java:122)
> >         at com.google.appengine.tools.development.DevAppServerFactory
> > $CustomSecurityManager.checkAccess(DevAppServerFactory.java:149)
> >         at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:288)
> >         at java.lang.Thread.init(Thread.java:332)
> >         at java.lang.Thread.<init>(Thread.java:377)
> >         at java.util.TimerThread.<init>(Timer.java:456)
> >         at java.util.Timer.<init>(Timer.java:71)
> >         at java.util.Timer.<init>(Timer.java:122)
> >         at com.mysql.jdbc.ConnectionImpl.<clinit>(ConnectionImpl.java:208)
> >         ... 34 more
>
> > What's going on? I tried the same code with my jsp and it works fine
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to