-->
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.  [ 3 posts ] 
Author Message
 Post subject: Deployment problems with tomcat and a struts / hibernate app
PostPosted: Wed Feb 02, 2005 6:22 am 
Newbie

Joined: Thu Jan 06, 2005 5:58 pm
Posts: 3
Location: DTC
Hibernate version: 2.16

Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
   <session-factory>
      <!-- local connection properties -->
      <property name="hibernate.connection.url">
         jdbc:pointbase://localhost:9092/soupex
      </property>
      <property name="hibernate.connection.driver_class">
         com.pointbase.jdbc.jdbcUniversalDriver
      </property>
      <property name="hibernate.connection.username">PBPUBLIC</property>
      <property name="hibernate.connection.password">pbpublic</property>
      <!-- property name="hibernate.connection.pool_size"></property -->
      <!-- dialect for Pointbase -->
      <property name="dialect">
         net.sf.hibernate.dialect.PointbaseDialect
      </property>
      <property name="hibernate.show_sql">true</property>
      <property name="hibernate.use_outer_join">true</property>
      <!--
         <property name="hibernate.transaction.factory_class">
         net.sf.hibernate.transaction.JTATransactionFactory
         </property>
         <property name="jta.UserTransaction">
         java:comp/UserTransaction
         </property>
      //-->
      <property name="hibernate.transaction.factory_class">
         net.sf.hibernate.transaction.JDBCTransactionFactory
      </property>
      <mapping resource="Roleparticipant.hbm" />
      <mapping resource="Composantiteration.hbm" />
      <mapping resource="Artefacttacheentree.hbm" />
      <mapping resource="Artefacttachesortie.hbm" />
      <mapping resource="Processus.hbm" />
      <mapping resource="Tacheproblemeresoud.hbm" />
      <mapping resource="Artefact.hbm" />
      <mapping resource="Projet.hbm" />
      <mapping resource="Iteration.hbm" />
      <mapping resource="Tache.hbm" />
      <mapping resource="Conditionsurdeftravail.hbm" />
      <mapping resource="Participanttachecol.hbm" />
      <mapping resource="Composant.hbm" />
      <mapping resource="Artefacttachecolsortie.hbm" />
      <mapping resource="Artefacttachecolentree.hbm" />
      <mapping resource="Tacheproblemeengendre.hbm" />
      <mapping resource="Activite.hbm" />
      <mapping resource="Activiteproduitsortie.hbm" />
      <mapping resource="Tachecolproblemeengendre.hbm" />
      <mapping resource="Produit.hbm" />
      <mapping resource="Metrique.hbm" />
      <mapping resource="Condition.hbm" />
      <mapping resource="Conditionsurtache.hbm" />
      <mapping resource="Participant.hbm" />
      <mapping resource="Deftravail.hbm" />
      <mapping resource="Tachecollaborative.hbm" />
      <mapping resource="Activiteproduitentree.hbm" />
      <mapping resource="Tachecolproblemeresoud.hbm" />
      <mapping resource="Probleme.hbm" />
      <mapping resource="Role.hbm" />
      <mapping resource="Conditiondt.hbm" />
      <mapping resource="Risque.hbm" />
   </session-factory>
</hibernate-configuration>

Code between sessionFactory.openSession() and session.close():

I use this hibernateUtil class:
Code:
package soup.metier;

import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;

public class HibernateUtil {

private static final SessionFactory sessionFactory;

static {
   try {
   // Crée la SessionFactory
   sessionFactory =
    new Configuration().configure().buildSessionFactory();
   } catch (HibernateException ex) {
   throw new RuntimeException("Problème de configuration : "
   + ex.getMessage(), ex);
   }
   }

public static final ThreadLocal session = new ThreadLocal();

public static Session currentSession()
      throws HibernateException {
   Session s = (Session) session.get();
   // Ouvre une nouvelle Session, si ce Thread n'en a aucune
   if (s == null) {
   s = sessionFactory.openSession();
   session.set(s);
   }
   return s;
   }

public static void closeSession()
      throws HibernateException {
   Session s = (Session) session.get();
   session.set(null);
   if (s != null)
   s.close();
   }
}

This class is used in this abstract class by calling HibernateUtil.currentSession():
Code:
public abstract class AccesMetierBase {
   /*attributs*/
   public Session hibernateSession;
   
   /*contructeur*/
   public AccesMetierBase() {
      try {
         hibernateSession = HibernateUtil.currentSession();
      } catch (HibernateException e) {
         System.out.println("Hibernate : Erreur de recuperation de la session hibernate : "
               + e.getMessages());
      }
   }
   
}


Problems:
I use this class in a struts project deployed on tomcat 5.0.28
When i deploye it at home (on windows XP pro, with j2ee sdk) there is no problems
But i got some problem when i deploye it at school.
When the HibernateUtil.currentSession() fonction is called, it's
impossible for it to find the hibernate.cfg.xml.

NB: For de deployement I only copy/paste the webapps folder of this website in the webapps folder of tomcat, and I started it.

Name and version of the database you are using:
pointbase installed whith j2ee 1.4

Full stack trace of any exception that occurs:]
Code:
2005-02-02 10:34:23 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2005-02-02 10:37:28 StandardWrapperValve[action]: "Servlet.service()" pour la servlet action a généré une exception
java.lang.ExceptionInInitializerError
   at soup.accesMetier.AccesMetierBase.<init>(AccesMetierBase.java:26)
   at soup.accesMetier.gestionProjet.GestionMembres.<init>(GestionMembres.java:22)
   at soup.form.LoginForm.validate(LoginForm.java:71)
   at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:921)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:206)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
   at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
   at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.RuntimeException: Problème de configuration : /hibernate.cfg.xml not found
   at soup.metier.HibernateUtil.<clinit>(HibernateUtil.java:22)
   ... 33 more
Caused by: net.sf.hibernate.HibernateException: /hibernate.cfg.xml not found
   at net.sf.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:872)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:896)
   at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
   at soup.metier.HibernateUtil.<clinit>(HibernateUtil.java:20)
   ... 33 more

_________________
°oO Pierrox Oo°


Top
 Profile  
 
 Post subject: try a war file
PostPosted: Wed Feb 02, 2005 2:05 pm 
Newbie

Joined: Mon Sep 06, 2004 1:39 pm
Posts: 18
Location: Utah, USA
You might try to use a WAR file for deployment. Many modern IDEs will provide this export functionality. With a WAR file you can be sure that all necessary files are available at deployment and in a structure that the container can find.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 6:27 pm 
Newbie

Joined: Thu Jan 06, 2005 5:58 pm
Posts: 3
Location: DTC
ok,
but is there something to in the web.xml file or into another file in order the application find the confg file ?

_________________
°oO Pierrox Oo°


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.