-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: my hibernate app does not work in weblogic 7
PostPosted: Wed Apr 19, 2006 9:29 am 
Newbie

Joined: Wed Apr 19, 2006 7:45 am
Posts: 1
The application works in Tomcat 5. But when deploy it into weblogic 7, I got below error message. I created this hibernate application using MyEclipse, and the hibernate.cfg.xml is generated by Myeclips.
Do you know what should I do in my weblogic server?



Hibernate 3.1:

Mapping documents:

Code between sessionFactory.openSession() and session.close():
package com.limited.menu.hibernate;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;

/**
* Configures and provides access to Hibernate sessions, tied to the
* current thread of execution. Follows the Thread Local Session
* pattern, see {@link http://hibernate.org/42.html}.
*/
public class CafeMenuSessionFactory {

/**
* Location of hibernate.cfg.xml file.
* NOTICE: Location should be on the classpath as Hibernate uses
* #resourceAsStream style lookup for its configuration file. That
* is place the config file in a Java package - the default location
* is the default Java package.<br><br>
* Examples: <br>
* <code>CONFIG_FILE_LOCATION = "/hibernate.conf.xml".
* CONFIG_FILE_LOCATION = "/com/foo/bar/myhiberstuff.conf.xml".</code>
*/
private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";

/** Holds a single instance of Session */
private static final ThreadLocal threadLocal = new ThreadLocal();

/** The single instance of hibernate configuration */
private static final Configuration cfg = new Configuration();

/** The single instance of hibernate SessionFactory */
private static org.hibernate.SessionFactory sessionFactory;

/**
* Returns the ThreadLocal Session instance. Lazy initialize
* the <code>SessionFactory</code> if needed.
*
* @return Session
* @throws HibernateException
*/
public static Session currentSession() throws HibernateException {
Session session = (Session) threadLocal.get();

if (session == null) {
if (sessionFactory == null) {
try {
cfg.configure(CONFIG_FILE_LOCATION);
sessionFactory = cfg.buildSessionFactory();
}
catch (Exception e) {
System.err.println("%%%% Error Creating SessionFactory %%%%");
e.printStackTrace();
}
}
session = sessionFactory.openSession();
threadLocal.set(session);
}

return session;
}

/**
* Close the single hibernate session instance.
*
* @throws HibernateException
*/
public static void closeSession() throws HibernateException {
Session session = (Session) threadLocal.get();
threadLocal.set(null);

if (session != null) {
session.close();
}
}

/**
* Default constructor.
*/
private CafeMenuSessionFactory() {
}

}

Full stack trace of any exception that occurs:

Name and version of the database you are using:
SQL Server 2000
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

%%%% Error Creating SessionFactory %%%%
org.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1173)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at com.limited.menu.hibernate.CafeMenuSessionFactory.currentSession(CafeMenuSessionFactory.java:48)
at com.limited.menu.hibernate.CafeMenuService.getAList(CafeMenuService.java:36)
at com.limited.menu.struts.action.TestAction.execute(TestAction.java:48)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1094)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:437)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:319)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5626)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:685)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3213)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2555)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:251)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:219)
Caused by: org.dom4j.DocumentException: http://xml.org/sax/features/use-locator2 Nested exception: http://xml.org/sax/features/use-locator2
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1168)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at com.limited.menu.hibernate.CafeMenuSessionFactory.currentSession(CafeMenuSessionFactory.java:48)
at com.limited.menu.hibernate.CafeMenuService.getAList(CafeMenuService.java:36)
at com.limited.menu.struts.action.TestAction.execute(TestAction.java:48)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1094)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:437)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:319)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5626)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:685)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3213)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2555)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:251)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:219)
Nested exception:
org.xml.sax.SAXNotRecognizedException: http://xml.org/sax/features/use-locator2
at weblogic.xml.jaxp.RegistryXMLReader.setupXMLReader(RegistryXMLReader.java:412)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:132)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1168)
... 19 more
<Apr 17, 2006 4:12:03 PM EDT> <Error> <HTTP> <101017> <[ServletContext(id=1512426,name=Menu,context-path=/Menu)] Root cause of ServletExcept
ion
java.lang.NullPointerException
at com.limited.menu.hibernate.CafeMenuSessionFactory.currentSession(CafeMenuSessionFactory.java:56)
at com.limited.menu.hibernate.CafeMenuService.getAList(CafeMenuService.java:36)
at com.limited.menu.struts.action.TestAction.execute(TestAction.java:48)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1094)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:437)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:319)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5626)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:685)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3213)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2555)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:251)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:219)
>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.