-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate3 weblogic 10.3.0 web app ExceptionInInitializerErr
PostPosted: Wed Oct 19, 2011 2:37 am 
Newbie

Joined: Wed Oct 19, 2011 2:16 am
Posts: 1
Hello All,

I am trying to deploy a web application which was developed using java 1.6 and tomcat on weblogic 10.3.0.0 server.

My hibernate.cfg.xml file contains --
Code:
<hibernate-configuration>
   <session-factory>
      <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
      <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
      <property name="hibernate.connection.username">NSE</property>
      <property name="hibernate.connection.password">nse</property>
      <property name="hibernate.connection.pool_size">10</property>
      <property name="hibernate.connection.release_mode">auto</property>
      <property name="dialect">org.hibernate.dialect.OracleDialect</property>
      <property name="hibernate.hbm2ddl.auto">update</property>
      <property name="current_session_context_class">thread</property>
      <property name="show_sql">false</property>
      <property name="format_sql">true</property>
      <property name="current_session_context_class">thread</property>

      <mapping resource="NSE.hbm.xml" />
   </session-factory>
</hibernate-configuration> 


I also have a connection.property file which contains --

Code:
conString=jdbc:oracle:thin:@localhost:1521:XE
driver=oracle.jdbc.driver.OracleDriver
Dialect=org.hibernate.dialect.OracleDialect
username=usrName
password=passWd


I have a helper class which helps me to get a new session object using the connection.property file . The contents are

Code:

public class HibernateUtil {

   private static final SessionFactory sessionFactory = buildSessionFactory();
   static final Logger logger = Logger.getLogger(HibernateUtil.class);

   private static SessionFactory buildSessionFactory() {
      try {
         // Create the SessionFactory from hibernate.cfg.xml
         Properties properties = new Properties();
         properties.load(Thread.currentThread().getContextClassLoader()
               .getResourceAsStream("connection.properties"));

         Configuration cfg = new Configuration();
         cfg = cfg.configure();
         cfg.setProperty("hibernate.connection.driver_class", properties
               .getProperty("driver"));
         cfg.setProperty("hibernate.connection.url", properties
               .getProperty("conString"));
         cfg.setProperty("hibernate.connection.username", properties
               .getProperty("username"));
         cfg.setProperty("hibernate.connection.password", properties
               .getProperty("password"));
         cfg.setProperty("hibernate.dialect", properties
               .getProperty("Dialect"));
         return cfg.buildSessionFactory();
      } catch (Throwable ex) {
      
         logger.error(ex.toString());
         throw new ExceptionInInitializerError(ex);
      }
   }

   public static SessionFactory getSessionFactory() {
      return sessionFactory;
   }


The application is running fine in tomcat 6 but when I try to deploy it on weblogic 10.3.0.0 I get the following error --

Code:
java.lang.ExceptionInInitializerError
   at login.LoginVerify.doPost(LoginVerify.java:66)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
   at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
   at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
   at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
   at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
   at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
   at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
   at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
   at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
   at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
   at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
   at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
   at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
   at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.NullPointerException
   at helper.HibernateUtil.buildSessionFactory(HibernateUtil.java:43)
   at helper.HibernateUtil.(HibernateUtil.java:18)



Am I missing something in my hibernate.cfg.xml ? Any help will be greatly appreciated!


Top
 Profile  
 
 Post subject: Re: Hibernate3 weblogic 10.3.0 web app ExceptionInInitializerErr
PostPosted: Wed Oct 19, 2011 11:17 pm 
Newbie

Joined: Wed Oct 19, 2011 11:13 pm
Posts: 1
Hi,

I've been having some similar problems. But I'm using Weblogic 10.3.5 and using hibernate 3.6.1. Can anyone help us?


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

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.