This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting Exception while executing hibernate plugin  RSS feed

Asif Usman
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

My name is Asif.

I am trying to Run one simple application using NetBeans IDE, and using Struts frame work with hibernate and MySQL database.
I am getting exection in while execting _factory = configuration.buildSessionFactory(); statement.

Here below is code of Hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sampledb</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLMyISAMDialect</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">asif</property>
<property name="connection.pool_size">3</property>
<property name="">update</property>
<property name="show_sql">true</property>
<mapping resource="/Model/test.hbm.xml"/>

code of


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());

its giving error and execution will hang when it executes below line

_factory = configuration.buildSessionFactory();

Erro Details:

2009-03-16 18:41:14 StandardContext[/WebApplication1]Marking servlet action as unavailable
2009-03-16 18:41:14 StandardContext[/WebApplication1]Servlet /WebApplication1 threw load() exception
javax.servlet.UnavailableException: org/aspectj/lang/Signature
at org.apache.struts.action.ActionServlet.init(
at javax.servlet.GenericServlet.init(
at org.apache.catalina.core.StandardWrapper.loadServlet(

tomcat server log ...

Mar 16, 2009 7:09:20 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Documents and Settings\Asif\My Documents\NetBeansProjects\WebApplication1\build\web\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources).
log4j:WARN Please initialize the log4j system properly.
**** Initilizing HibernatePlugIn **********

(its hanged here)

In browser i get this message.

HTTP Status 503 - Servlet action is currently unavailable

Please can anyone help on this. i am working on this from past 3 days but not getting what to do..

Thanks in advance!

Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Asif,

Welcome to JavaRanch!

Verify the value of _configFilePath. The error stacktrace doesn't seem to be informative. Why don't you try to isolate the problem? Make a small Java standalone programme and try to get a reference to session factory.

Apart from your problem refer this. . It gives ease in reading the post.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!