• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
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
().buildSessionFactory();
I get java.lang.ExceptionInInitializerError at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:
284).

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:
Class.forName("com.mysql.jdbc.Driver");
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:
http://rapidshare.de/files/48409199/ttt.zip.html
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
(RPC.java:360)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
(RPC.java:546)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
(RemoteServiceServlet.java:166)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
(RemoteServiceServlet.java:86)
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:
487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1093)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at com.google.appengine.tools.development.StaticFileFilter.doFilter
(StaticFileFilter.java:124)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
(DevAppEngineWebAppContext.java:54)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:313)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
506)
at org.mortbay.jetty.HttpConnection$RequestHandler.content
(HttpConnection.java:844)
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
(SelectChannelEndPoint.java:396)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run
(BoundedThreadPool.java:442)
Caused by: java.lang.ExceptionInInitializerError
at com.mysql.jdbc.NonRegisteringDriver.connect
(NonRegisteringDriver.java:284)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at ro.mercury.server.GreetingServiceImpl.greetServer
(GreetingServiceImpl.java:23)
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
(RPC.java:527)
... 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
$CustomSecurityManager.checkPermission(DevAppServerFactory.java:128)
at com.google.appengine.tools.development.DevAppServerFactory
$CustomSecurityManager.checkAccess(DevAppServerFactory.java:155)
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.

Truly,
Stefan Voinea
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic