File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Getting Exception while executing hibernate plugin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Getting Exception while executing hibernate plugin" Watch "Getting Exception while executing hibernate plugin" New topic

Getting Exception while executing hibernate plugin

Asif Usman

Joined: Mar 16, 2009
Posts: 12
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

Joined: Aug 16, 2007
Posts: 1374
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.
I agree. Here's the link:
subject: Getting Exception while executing hibernate plugin
It's not a secret anymore!