java.lang.NoClassDefFoundError: Could not initialize class com.server.HibernateSessionFactory

609 views
Skip to first unread message

fomba collins

unread,
May 10, 2010, 5:34:04 AM5/10/10
to GWT Group
Hi,
    I have a class (Connection) on the server side that accesses the database through hibernate. The connection on the server side is perfect. I want to use RPC to call these methods on the client side. I then create an Implementation class (ConnectionImpl) on the server that calls one of the methods of the Connection class.ie the method connecto. Here is the Implementation class.
 

public

class ConnectionImpl extends RemoteServiceServlet implements

ConnectionService{

/**

*

*/

private static final long serialVersionUID = 1L;

Connection con = new Connection(); /*The class that performs database access through hibernate*/

public boolean connecto(String login, String password)throws IllegalArgumentException{

return con.connect(login, password);//connect() returns a boolean

}

}
 
Then on the client side, I have the ConnectionService and ConnectionServiceAsync interfaces:
 
public interface ConnectionService extends RemoteService {
 boolean connecto(String login, String password)throws IllegalArgumentException;
}
 
and
 

public

interface ConnectionServiceAsync {

void connecto(String login, String password, AsyncCallback<Boolean> callback)

throws IllegalArgumentException;

}
 
The web.xml conf file is as follows:
 

<?

xml version="1.0" encoding="UTF-8"?>

<!

DOCTYPE web-app

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">

<

web-app>

<!-- Servlets -->

<servlet>

<servlet-name>connectionServlet</servlet-name>

<servlet-class>com.server.ConnectionServiceImpl</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>connectionServlet</servlet-name>

<url-pattern>/webtop/connection</url-pattern>

</servlet-mapping>

<!-- Default page to serve -->

<welcome-file-list>

<welcome-file>Webtop.html</welcome-file>

</welcome-file-list>

</

web-app>

 

But when I run and enter values to execute through rpc, I get the following error:

 

 

SEVERE: [1273482832366000] javax.servlet.ServletContext log: Exception while dispatching incoming RPC call

com.google.gwt.user.server.rpc.UnexpectedException

: Service method 'public abstract boolean com.extjs.gxt.samples.desktop.client.ConnectionService.connecto(java.lang.String,java.lang.String) throws java.lang.IllegalArgumentException' threw an unexpected exception: java.lang.NoClassDefFoundError: Could not initialize class com.extjs.gxt.samples.desktop.server.HibernateSessionFactory

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:713)

at javax.servlet.http.HttpServlet.service(

HttpServlet.java:806)

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:51)

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:349)

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:218)

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: Could not initialize class com.extjs.gxt.samples.desktop.server.HibernateSessionFactory

at com.extjs.gxt.samples.desktop.server.BaseHibernateDAO.getSession(

BaseHibernateDAO.java:13)

at com.extjs.gxt.samples.desktop.server.EvutiDAO.findAll(

EvutiDAO.java:104)

at com.extjs.gxt.samples.desktop.server.Connection.getLogin(

Connection.java:42)

at com.extjs.gxt.samples.desktop.server.Connection.connect(

Connection.java:69)

at com.extjs.gxt.samples.desktop.server.ConnectionServiceImpl.connecto(

ConnectionServiceImpl.java:16)

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:562)

... 30 more

Remote Procedure Call - Failure
   


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Sripathi Krishnan

unread,
May 10, 2010, 6:47:59 AM5/10/10
to google-we...@googlegroups.com
Do you have Google App Engine enabled in your project preferences? GAE doesn't allow you to connect to databases, and you usually get a NoClassDefFoundError when you attempt to connect...

--Sri
Reply all
Reply to author
Forward
0 new messages