Hello All,
I am new to hibernate world , tried struts-hibernate application tutorial from
http://www.roseindia.net/struts/struts- ... lHibernate 3.1.1 link but throwing exceptions while retriving data from database.
This following code is about my hibernatePlugIn class, some importtant part, using mysql 5.0 as database and running this application on Tomact apache 5.5 server.
---------------------------------------------------------------------------
public void init(ActionServlet servlet, ModuleConfig config) throws ServletException {
System.out.println("*************************************");
System.out.println("**** Initilizing HibernatePlugIn **********");
Configuration configuration = null;
URL configFileURL = null;
ServletContext context = null;
try{
configFileURL = HibernatePlugIn.class.getResource(_configFilePath);
context = servlet.getServletContext();
configuration = (new Configuration()).configure(configFileURL);
_factory = configuration.buildSessionFactory();
//Set the factory into session
context.setAttribute(SESSION_FACTORY_KEY, _factory);
}catch(HibernateException e){
System.out.println("Error while initializing hibernate: " + e.getMessage());
}
System.out.println("*************************************");
}
-------------------------------------------------------------------------------
while running application it is throwing this exception
javax.servlet.ServletException: Servlet.init() for servlet action threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)
root cause
java.lang.AbstractMethodError: com.HibernatePlugIn.init(Lorg/apache/struts/action/ActionServlet;Lorg/apache/struts/config/ApplicationConfig;)V
org.apache.struts.action.ActionServlet.initApplicationPlugIns(ActionServlet.java:991)
org.apache.struts.action.ActionServlet.init(ActionServlet.java:458)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)
----------------------------------------------------------------------------
Thanks in advance