You have google app engine enabled, and it's not compatible with
FileOutputStream or creating sockets. You should disable it unless you intend
to deploy to GAE.
On 05/06/11 19:13, Farid Derradji wrote:
Hello all,
THE GENERAL PROBLEM
I am a novice in programming with GWT and I started developing a test
application which communicates
with the server side via GWT-RPC . The servlet in turn tries to establish a
connection with a Derby Database.
But, however, no matter which mode the servlet uses - either embedded or
client/server mode - nothing works.
If the servlet tries to communicate with the Apache Derby Database in embedded
mode, it gets the following
exception stack:
...
Caused by: java.lang.NoClassDefFoundError: java.io.FileOutputStream is a
restricted class. Please see the Google App Engine developer's guide for more
details.
...
If it tries to communicate with the Apache Derby Database in client/server
mode, it gets the following
exception stack:
...
Caused by: java.lang.NoClassDefFoundError: javax.net.SocketFactory is a
restricted class. Please see the Google App Engine developer's guide for more
details.
...
MY LOCAL CONFIGURATION
Operating System: Windows 7
JDK: Jdk1.6.0_21
IDE: Eclipse Java EE 3.6 (Helios)
GWT Version: 2.3
Derby DB Version: 10.8.1.2
My CODE SNIPPET
In order to formulate database requests I decided to use JDBC (4.0 or higher).
I did not explicitely
initialize the according database driver, since I am using JDK 6. The code
snippet looks like the
following:
// .implement ---------------------------------------------------------------
...
@Override
*public*UserAccount[] retrieveAllUserAccounts () *throws*WrapperException
{
// Get database connection ------------------------------------------------
Connection l_sConn = *null*;
*try*
{
// l_sConn = DriverManager.getConnection
("jdbc:derby:D:\\_db_-derby-10.8.1.2-bin\\DERBYTUTOR\\userManagement");
l_sConn =
DriverManager./getConnection/("jdbc:derby://localhost:1527/userManagement");
}
*catch*(SQLException ex)
{
// // Try to make a shutdown and throw exception again ---------------------
// try
// {
// DriverManager.getConnection ("jdbc:derby:;shutdown=true");
// }
// catch (SQLException _se_)
// {}
*throw**new*WrapperException (ex.getMessage (),
ex.getStackTrace().toString (),
ex.getCause ().getMessage());
}
*try*
{
// perform SELECT statement -----------------------------------------------
Statement l_selectStatement = l_sConn.createStatement();
ResultSet l_setOfUsers = l_selectStatement.executeQuery ("select * from
USERACCOUNTS");
List<UserAccount> l_lUserAccounts = *new*ArrayList<UserAccount>();
*while*(l_setOfUsers.next())
{
UserAccount l_boUserAccount = *new*UserAccount (l_setOfUsers.getString (1),
l_setOfUsers.getString (2),
l_setOfUsers.getString (3));
l_lUserAccounts.add (l_boUserAccount);
}
// release resources and return -------------------------------------------
l_selectStatement.close ();
l_setOfUsers .close ();
l_sConn .close ();
// try
// {
// DriverManager.getConnection("jdbc:derby:;shutdown=true");
// }
// catch (SQLException _se_)
// {
// if (! se.getSQLState ().equals ("XJ015"))
// {
// throw _se_;
// }
// }
*return*l_lUserAccounts.toArray (*new*UserAccount[0]);
}
*catch*(SQLException ex)
{
*throw**new*WrapperException (ex.getMessage (),
ex.getStackTrace ().toString (),
ex.getCause ().getMessage ());
}
} // End Method retrieveAllUserAccounts -------------------------------------
...
For any hints how to solve that problem I would be very glad.
Regards and thanks in advance
Farid
--
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.