Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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 log
SEVERE: [1253789209422000] javax.servlet.ServletContext log: Exception
while dispatching incoming RPC call Service method
'public abstract java.lang.String
ro.mercury.client.GreetingService.greetServer(java.lang.String)' threw
an unexpected exception: java.lang.ExceptionInInitializerError
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.mortbay.jetty.servlet.ServletHolder.handle(
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
at org.mortbay.jetty.servlet.ServletHandler.handle
at org.mortbay.jetty.servlet.SessionHandler.handle
at org.mortbay.jetty.handler.ContextHandler.handle
at org.mortbay.jetty.webapp.WebAppContext.handle(
at org.mortbay.jetty.handler.HandlerWrapper.handle
at org.mortbay.jetty.handler.HandlerWrapper.handle
at org.mortbay.jetty.Server.handle(
at org.mortbay.jetty.HttpConnection.handleRequest(
at org.mortbay.jetty.HttpConnection$RequestHandler.content
at org.mortbay.jetty.HttpParser.parseNext(
at org.mortbay.jetty.HttpParser.parseAvailable(
at org.mortbay.jetty.HttpConnection.handle(
at org.mortbay.thread.BoundedThreadPool$
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)
... 27 more
Caused by: access denied
(java.lang.RuntimePermission modifyThreadGroup)
at Source)
at Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
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>(
... 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
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic