java.net.Socket isn't in white list class: http://code.google.com/appengine/docs/java/jrewhitelist.html
Juan 2011/3/22 sapna.dr <[email protected]> > Hi, > We have implemented a GWT application. > Now, while trying to connect to the Oracle DB to the GWT we are facing > the exceptions like below > > javax.servlet.ServletContext log: Exception while dispatching incoming > RPC call > com.google.gwt.user.server.rpc.UnexpectedException: Service method > 'public abstract void > com.bt.BRAS.client.BRASDataInsertService.sampleMethod()' 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: > 378) > at > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java: > 581) > at > > com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java: > 188) > at > > com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java: > 224) > at > > com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.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(ServeBlobFilter.java: > 58) > at org.mortbay.jetty.servlet.ServletHandler > $CachedChain.doFilter(ServletHandler.java:1157) > at > > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java: > 43) > at org.mortbay.jetty.servlet.ServletHandler > $CachedChain.doFilter(ServletHandler.java:1157) > at > > com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.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(DevAppEngineWebAppContext.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:212) > 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 oracle.net.nt.TcpNTAdapter.connect(Unknown Source) > at oracle.net.nt.ConnOption.connect(Unknown Source) > at oracle.net.nt.ConnStrategy.execute(Unknown Source) > at oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown > Source) > at oracle.net.ns.NSProtocol.establishConnection(Unknown Source) > at oracle.net.ns.NSProtocol.connect(Unknown Source) > at oracle.jdbc.ttc7.TTC7Protocol.connect(TTC7Protocol.java:1687) > at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:214) > at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java: > 346) > at > oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java: > 468) > at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314) > at java.sql.DriverManager.getConnection(DriverManager.java:582) > at java.sql.DriverManager.getConnection(DriverManager.java:185) > at com.bt.BRAS.server.JDBCUitl.getConnection(JDBCUitl.java:19) > at > > com.bt.BRAS.server.BRASDataInsertServiceImpl.sampleMethod(BRASDataInsertServiceImpl.java: > 29) > 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.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java: > 100) > at > com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java: > 562) > ... 30 more > > The code implemented is as follows > > > > package com.bt.BRAS.server; > > import java.sql.Connection; > import java.sql.DriverManager; > import java.sql.SQLException; > > import com.bt.BRAS.shared.JDBCConstants; > > public class JDBCUitl > { > > private static Connection dbConnection = null; > > public static Connection getConnection() throws > ClassNotFoundException, SQLException > { > Class.forName(JDBCConstants.DRIVER_NAME); > dbConnection=DriverManager.getConnection(JDBCConstants.URL, > JDBCConstants.USERNAME,JDBCConstants.PASSWORD); > return dbConnection; > } > } > > > package com.bt.BRAS.shared; > > public final class JDBCConstants > { > public static final String URL = > "jdbc:oracle:thin:@172.21.136.63:1521:hibernatedemouser"; > public static final String DRIVER_NAME = > "oracle.jdbc.driver.OracleDriver"; > public static final String USERNAME = "scott"; > public static final String PASSWORD = "devuser"; > > > } > > > package com.bt.BRAS.shared; > > public final class JDBCQueries > { > public static String SAMPLE_QUERY = "SELECT BANNER FROM SYS.V_ > $VERSION"; > } > > package com.bt.BRAS.server; > > import java.sql.Connection; > import java.sql.PreparedStatement; > import java.sql.ResultSet; > import java.sql.SQLException; > import java.sql.Statement; > > import com.bt.BRAS.client.BRASDataInsertService; > import com.bt.BRAS.shared.JDBCQueries; > import com.google.gwt.user.server.rpc.RemoteServiceServlet; > > > public class BRASDataInsertServiceImpl extends RemoteServiceServlet > implements BRASDataInsertService > { > > private static final long serialVersionUID = -314336746400468627L; > > public void sampleMethod() > { > PreparedStatement pStatement = null; > ResultSet resultSet = null; > Connection dbConnection = null; > try > { > System.out.println("0"); > dbConnection = JDBCUitl.getConnection(); > pStatement = > dbConnection.prepareStatement(JDBCQueries.SAMPLE_QUERY); > resultSet = > pStatement.executeQuery(JDBCQueries.SAMPLE_QUERY); > while(resultSet.next()) > { > System.out.println("SIZE:" + > resultSet.getFetchSize()); > } > > } catch (ClassNotFoundException classException) > { > classException.printStackTrace(); > } catch (SQLException sqlException) > { > sqlException.printStackTrace(); > }finally > { > try > { > pStatement.close(); > resultSet.close(); > dbConnection.close(); > }catch(SQLException sqlException){ > System.out.println("SQL Exception in finally > block"); > sqlException.printStackTrace(); > }catch(NullPointerException nException){ > System.out.println("NullPointerException in > finally block"); > nException.printStackTrace(); > } > } > } > > } > > I am getting the exception in the line > "dbConnection=DriverManager.getConnection(JDBCConstants.URL, > JDBCConstants.USERNAME,JDBCConstants.PASSWORD);" > > > I have imported "ojdbc14.jar" jar file into the class path > > > Please guide on this. > > Thanks, > Sapna > > -- > 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. > > -- 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.
