• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Greetings Eclipse Gwt Project - jdbc connection problems java.lang.ExceptionInInitializerError

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,

Long story short is like this: I started to develop a Gwt-Ext
application in Eclipse as a Dynamic Web Project (the tutorial that I
have followed gave me this start). Then I added Hibernate to do the
persistence and some business logic. Every thing went smooth till I
tried to deploy the app to Tomcat. This proved to be a pain in the ass
because the project wasn't a Gwt project so the war arhive was not
constructed well. I needed to do some ant work to deploy correctly the
app. Opposed to this I got the aternative to make a blank (not so
blank Greeting) project and add the sources, libs etc that I had in
the first project. Smooth again, no compiler erros, libs putted in lib
folder and added in Java build path and also in war\WEB-INF\lib\. The
problem is that when I try to execute
sessionFactory = new AnnotationConfiguration().configure
I get java.lang.ExceptionInInitializerError at

Not knowing what went wrong even after hours of googleing I decided to
isolate the problem. So I created a new Gwt project. Eclipse created
for me standar packages and default sources (GreetingService stuff).
Then I copied in lib folder (created by me) the mysql connector, add
also to Java build path, add 3 lines to GreetingServiceImpl:
String url = "jdbc:mysql://localhost:3306/mercury";
Connection con = DriverManager.getConnection(url,"root", "root");
No comilation error but at runtime when I try to execute this piese of
code the same ExceptionInInitializerError occurs.

I mention that there are no database conectivity problems (the error
is the same even if the server is closed so it doesn't even get to the
actual connecting) and I have also made a simple Java project with a
main function that connects with the same connnector in the same
fashion with no problems at all.

To be more clear I have archived the project and uploaded here:
The full stack trace is bellow:

The server is running at http://localhost:8080/
Sep 24, 2009 10:46:49 AM
com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: [1253789209422000] javax.servlet.ServletContext log: Exception
while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract java.lang.String
ro.mercury.client.GreetingService.greetServer(java.lang.String)' threw
an unexpected exception: java.lang.ExceptionInInitializerError
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
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:
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
at com.google.appengine.tools.development.StaticFileFilter.doFilter
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
at org.mortbay.jetty.servlet.ServletHandler.handle
at org.mortbay.jetty.security.SecurityHandler.handle
at org.mortbay.jetty.servlet.SessionHandler.handle
at org.mortbay.jetty.handler.ContextHandler.handle
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
at org.mortbay.jetty.handler.HandlerWrapper.handle
at com.google.appengine.tools.development.JettyContainerService
at org.mortbay.jetty.handler.HandlerWrapper.handle
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
at org.mortbay.jetty.HttpConnection$RequestHandler.content
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
at org.mortbay.thread.BoundedThreadPool$PoolThread.run
Caused by: java.lang.ExceptionInInitializerError
at com.mysql.jdbc.NonRegisteringDriver.connect
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at ro.mercury.server.GreetingServiceImpl.greetServer
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
... 27 more
Caused by: java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThreadGroup)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at com.google.appengine.tools.development.DevAppServerFactory
at com.google.appengine.tools.development.DevAppServerFactory
at java.lang.ThreadGroup.checkAccess(Unknown Source)
at java.lang.Thread.init(Unknown Source)
at java.lang.Thread.<init>(Unknown Source)
at java.util.TimerThread.<init>(Unknown Source)
at java.util.Timer.<init>(Unknown Source)
at java.util.Timer.<init>(Unknown Source)
at com.mysql.jdbc.ConnectionImpl.<clinit>(ConnectionImpl.java:258)
... 36 more

Can anyone help me... any ideeas on how to connect on server side to a
data base in a Gwt app?

Thank you in advance. I'm waiting your answer.

Stefan Voinea
    Bookmark Topic Watch Topic
  • New Topic