• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Urgent help deploying hibernate app

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i have a hibernate application working well in my home machine. i am trying to deploy that application on my other machine. i took a backup of mysql datbase and recreated teh database on the other machine. i dropped the war file under webapps directory of the new machine and restarted tomcat and tried to login. i get the following error message
org.hibernate.MappingException : could not read mappings from resources: User.hbm.xml.

i checked the configuration files and all the files are in place. i am clueless why the app is not working. Any advice.
Thanks
Rashid
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This workaround works for me:
I had a .jar and a .ear file. I modified the .ear file placing the configuration file (hibernate.cfg.xml) in root of dir, after I closed the file accepting changes, I deployed again, and my Application Server found my mapping resources.

I hope this helps
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i had this application working in my netbeans environemtn. i created the war file and iam trying it to deploy to remote server. Let me mention how i am palcing my files
under my web-inf classes folder i got hibernate.cfg.xml, User.hbm.xml and other mapping files
this is my hibernate.cfg.xml file definition
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.username">hms_user</property>
<property name="hibernate.connection.password">hms_user</property>
<property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/hms
</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect </property>
<mapping resource="User.hbm.xml"/>
<mapping resource="Test.hbm.xml"/>
<mapping resource="UserSubscription.hbm.xml"/>
</session-factory>
</hibernate-configuration>

i am doubting it to be versioning issue, cant be sure still?
Rashid
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
let me add one more thing, the only thing which i doubt is i get digester error. something like org.apache.common.digester.Digester.error - Attirbute "session" must be declared for element type "action".

Do you this has something to do with that.

Rashid
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post your exception stacktrace
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok here is teh deal.
i am able to make that app work when i am connected on line. i came across this type of problem with tiles-def.xml where it looks online for a valid dtd. i tried many times toggling the internet connection and whenever the connection is off the app doesn't work saying it cant parse user.hbm.xml and it gives some sax exception. since you asked for it here is the exception trace when the internet connection is set off. BTW, can i change teh header declaration and make the hibernate work even without intenet connnection Please let me know

org.hibernate.MappingException: Could not read mappings from resource: /User.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at com.hms.dao.HibernateUtil.<clinit>(HibernateUtil.java:38)
at com.hms.dao.UserDao.isUserValid(UserDao.java:88)
at com.hms.helper.UserHelper.isUserValid(UserHelper.java:38)
at com.hms.action.LoginAction.execute(LoginAction.java:65)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at com.hms.action.MainActionController.process(MainActionController.java:28)
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:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.MappingException: Could not parse mapping document in input stream
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok i unjar the hibernate3.jar file and copied the declaration from hibernatemapping.dtd and it works fine now even though with out an internet connection.
Thanks
everybody
 
reply
    Bookmark Topic Watch Topic
  • New Topic