Also, I am trying to access via HSQLDB. My class is:
public class ManejadorBD {
public boolean checkUser(String user, String pass) throws
Exception{
Class.forName("org.hsqldb.jdbcDriver");
Properties prop = new Properties();
prop.load(this.getClass().getResource("database.properties").openStream());
JDBCDriver driver = new JDBCDriver();
Connection conn = driver.connect("jdbc:postgresql://
localhost:
5432/3encult", prop);
String sql = "SELECT login,password FROM \"user\"";
Statement statement = (JDBCStatement)
conn.createStatement();
ResultSet tabla = statement.executeQuery(sql);
while(tabla.next()){
if(user == tabla.getString("login") && pass
==
tabla.getString("password")) return true;
else return false;
}
}
}
And the properties file is:
user=3encult
password=3encult
I read ctbe properties file and I can obtain the user and password,
but when I want to connect to database I obtain null. On API Webpage
is said that properties file at least should be contain user and
password. Also I call to acceptsURL method with the URL of database
and it is returned true. Then, the connection to URL can be
established, but the properties are not loaded. The user and pass are
OK! I have created the user on database.
http://hsqldb.sourceforge.net/doc/2.0/apidocs/org/hsqldb/jdbc/JDBCDriver.html#connect(java.lang.String,
java.util.Properties)
http://hsqldb.sourceforge.net/doc/2.0/apidocs/org/hsqldb/jdbc/JDBCDriver.html#acceptsURL(java.lang.String)
On Apr 6, 4:25 pm, Juan Pablo Gardella <[email protected]>
wrote:
> If is a GAE application, I think that you can't use SQL database, but I
> don't know GAE-
>
> 2011/4/6 Jose Luis Hernandez <[email protected]>
>
>
>
>
>
>
>
> > It is an application, but in future it should be integrated into OSGi,
> > then deploy in Felix server!
>
> > On Apr 6, 4:15 pm, Juan Pablo Gardella <[email protected]>
> > wrote:
> > > Are you do an Google App Engine Application or a simple GWT applitacion?
> > If
> > > is a GWT application, remove of project configuration that use GAE SDK.
>
> > > 2011/4/6 Jose Luis Hernandez <[email protected]>
>
> > > > then, how can I access to pastgres database? Because I am using the
> > > > java.sql package that is permited.
>
> > > > On Apr 6, 3:14 pm, Juan Pablo Gardella <[email protected]>
> > > > wrote:
> > > > > You are used restricted classes: java.lang.NoClassDefFoundError:
> > > > > java.net.Socket is a restricted class.
>
> > > > > See whitelist <
> > > >http://code.google.com/appengine/docs/java/jrewhitelist.html>
> > > > > classes
>
> > > > > 2011/4/6 Jose Luis Hernandez <[email protected]>
>
> > > > > > Well, the new error is:
>
> > > > > > [ERROR] javax.servlet.ServletContext log: Exception while
> > dispatching
> > > > > > incoming RPC call
> > > > > > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > > > > > 'public abstract boolean
>
> > com.gwt.app.client.GreetingService.greetServer(java.lang.String,java.lang.S
> > > > tring)
> > > > > > throws java.lang.Exception' threw an unexpected exception:
> > > > > > java.lang.NoClassDefFoundError: java.net.Socket is a restricted
> > class.
> > > > > > Please see the Google App Engine developer's guide for more
> > details.
> > > > > > at
>
> > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> > > > > > 385)
> > > > > > at
>
> > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
> > > > > > 588)
> > > > > > at
>
> > com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServi
> > > > ceServlet.java:
> > > > > > 208)
> > > > > > at
>
> > com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServi
> > > > ceServlet.java:
> > > > > > 248)
> > > > > > at
>
> > com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(Abstract
> > > > RemoteServiceServlet.java:
> > > > > > 62)
> > > > > > at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> > > > > > at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> > > > > > at
> > > > > > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > > > > > 511)
> > > > > > at org.mortbay.jetty.servlet.ServletHandler
> > > > > > $CachedChain.doFilter(ServletHandler.java:1166)
> > > > > > at
>
> > com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFi
> > > > lter.java:
> > > > > > 58)
> > > > > > at org.mortbay.jetty.servlet.ServletHandler
> > > > > > $CachedChain.doFilter(ServletHandler.java:1157)
> > > > > > at
>
> > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(Trans
> > > > actionCleanupFilter.java:
> > > > > > 43)
> > > > > > at org.mortbay.jetty.servlet.ServletHandler
> > > > > > $CachedChain.doFilter(ServletHandler.java:1157)
> > > > > > at
>
> > com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFile
> > > > Filter.java:
> > > > > > 122)
> > > > > > at org.mortbay.jetty.servlet.ServletHandler
> > > > > > $CachedChain.doFilter(ServletHandler.java:1157)
> > > > > > at
>
> > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> > > > > > 388)
> > > > > > at
>
> > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> > > > > > 216)
> > > > > > at
>
> > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> > > > > > 182)
> > > > > > at
>
> > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> > > > > > 765)
> > > > > > at
> > > > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> > > > > > 418)
> > > > > > at
>
> > com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEn
> > > > gineWebAppContext.java:
> > > > > > 70)
> > > > > > at
>
> > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> > > > > > 152)
> > > > > > at
> > com.google.appengine.tools.development.JettyContainerService
> > > > > > $ApiProxyHandler.handle(JettyContainerService.java:351)
> > > > > > at
>
> > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> > > > > > 152)
> > > > > > at org.mortbay.jetty.Server.handle(Server.java:326)
> > > > > > at
> > > > > > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> > > > > > 542)
> > > > > > at org.mortbay.jetty.HttpConnection
> > > > > > $RequestHandler.content(HttpConnection.java:938)
> > > > > > at
> > org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
> > > > > > at
> > > > org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
> > > > > > at
> > > > org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> > > > > > at
>
> > org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> > > > > > 409)
> > > > > > at org.mortbay.thread.QueuedThreadPool
> > > > > > $PoolThread.run(QueuedThreadPool.java:582)
> > > > > > Caused by: java.lang.NoClassDefFoundError: java.net.Socket is a
> > > > > > restricted class. Please see the Google App Engine developer's
> > guide
> > > > > > for more details.
> > > > > > at
>
> > com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime
> > > > .java:
> > > > > > 51)
> > > > > > at org.postgresql.core.PGStream.<init>(PGStream.java:62)
> > > > > > at
>
> > org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionF
> > > > actoryImpl.java:
> > > > > > 76)
> > > > > > at
>
> > org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java
> > > > :
> > > > > > 66)
> > > > > > at
>
> > org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection
> > > > .java:
> > > > > > 125)
> > > > > > at
>
> > org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection
> > > > .java:
> > > > > > 30)
> > > > > > at
> > > > org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:
> > > > > > 24)
> > > > > > at org.postgresql.Driver.makeConnection(Driver.java:393)
> > > > > > at org.postgresql.Driver.connect(Driver.java:267)
> > > > > > at
> > java.sql.DriverManager.getConnection(DriverManager.java:582)
> > > > > > at
> > java.sql.DriverManager.getConnection(DriverManager.java:185)
> > > > > > at
> > com.gwt.app.server.ManejadorBD.checkUser(ManejadorBD.java:11)
> > > > > > at
>
> > com.gwt.app.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java
> > > > :
> > > > > > 15)
> > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > > > > > at
>
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > > > 39)
> > > > > > at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> > > > l.java:
> > > > > > 25)
> > > > > > at java.lang.reflect.Method.invoke(Method.java:597)
> > > > > > at
>
> > com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime
> > > > .java:
> > > > > > 100)
> > > > > > at
>
> > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
> > > > > > 569)
> > > > > > ... 30 more
>
> > > > > > On Apr 5, 8:51 pm, Juan Pablo Gardella <
> > [email protected]>
> > > > > > wrote:
> > > > > > > Put postgresql driver in WEB-INF/lib
>
> > > > > > > Juan
>
> > > > > > > 2011/4/5 Jose Luis Hernandez <[email protected]>
>
> > > > > > > > Hello!
> > > > > > > > I am trying to connect my gwt server with postgreSQL database,
> > but
> > > > I
> > > > > > > > do not get it. It appears the following error message:
>
> > > > > > > > [ERROR] javax.servlet.ServletContext log: Exception while
> > > > dispatching
> > > > > > > > incoming RPC call
> > > > > > > > com.google.gwt.user.server.rpc.UnexpectedException: Service
> > method
> > > > > > > > 'public abstract boolean
>
> > com.gwt.app.client.GreetingService.greetServer(java.lang.String,java.lang.S
> > > > tring)
> > > > > > > > throws java.lang.Exception' threw an unexpected exception:
> > > > > > > > java.lang.NoClassDefFoundError: org.postgresql.core.Logger is a
> > > > > > > > restricted class. Please see the Google App Engine developer's
> > > > guide
> > > > > > > > for more details.
> > > > > > > > at
>
> > > > com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> > > > > > > > 385)
> > > > > > > > at
>
> > > > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
> > > > > > > > 588)
> > > > > > > > at
>
> > com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServi
> > > > ceServlet.java:
> > > > > > > > 208)
> > > > > > > > at
>
> > com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServi
> > > > ceServlet.java:
> > > > > > > > 248)
> > > > > > > > at
>
> > com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(Abstract
> > > > RemoteServiceServlet.java:
> > > > > > > > 62)
> > > > > > > > at
> > > > javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> > > > > > > > at
> > > > javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> > > > > > > > at
>
> > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > > > > > > > 511)
> > > > > > > > at org.mortbay.jetty.servlet.ServletHandler
> > > > > > > > $CachedChain.doFilter(ServletHandler.java:1166)
> > > > > > > > at
>
> ...
>
> read more »
--
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.