-->
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: Hibernate and JBoss
PostPosted: Fri Feb 11, 2005 10:03 am 
Newbie

Joined: Tue Feb 08, 2005 12:04 pm
Posts: 11
Location: London
Hi,

I have to deploy my existing Hibernate code on JBoss. Its perfectly working standalone but giving exceptions on JBoss.

Configuration cfg = new Configuration();

SessionFactory factory = cfg.configure().buildSessionFactory();
Session sessions = factory.openSession();

Transaction t = sessions.beginTransaction();

sessions.save(c);
sessions.save(p);
t.commit();
sessions.close();

////////////// HIBERNATE.CFG.XML //////////////////////////////

<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory >
<property name="show_sql">true</property>
<mapping resource="org/ultimania/dto/Contact.hbm.xml"/>
<mapping resource="org/ultimania/dto/Person.hbm.xml"/>
<mapping resource="org/ultimania/dto/ContactMethod.hbm.xml"/>
<mapping resource="org/ultimania/dto/EntityType.hbm.xml"/>
<mapping resource="org/ultimania/dto/Gender.hbm.xml"/>
</session-factory>
</hibernate-configuration>

///////////////// STACK TRACE ///////////////////////////////
javax.servlet.ServletException: Resource: org/ultimania/dto/Contact.hbm.xml not found
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.test_jsp._jspService(test_jsp.java:117)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)


root cause

net.sf.hibernate.MappingException: Resource: org/ultimania/dto/Contact.hbm.xml not found
net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:334)
net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)
net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
org.apache.jsp.test_jsp._jspService(test_jsp.java:96)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

_________________
Regards,

Ahsan


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 11, 2005 11:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
org/ultimania/dto/Contact.hbm.xml is *not* on avaialble as a resource (i.e., not on the classpath) from your code constructing the Configuration.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 11, 2005 11:46 am 
Newbie

Joined: Tue Feb 08, 2005 12:04 pm
Posts: 11
Location: London
Thanx,

Now My code is executing on Tomcat but its giving me a strange exception on jboss.

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:520)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)


root cause

java.lang.NullPointerException
org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:153)
org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:464)
org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:374)
java.lang.ClassLoader.loadClass(ClassLoader.java:235)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:141)
org.apache.tools.ant.AntTypeDefinition.getTypeClass(AntTypeDefinition.java:161)
org.apache.tools.ant.AntTypeDefinition.getExposedClass(AntTypeDefinition.java:135)
org.apache.tools.ant.ComponentHelper$AntTypeTable.getExposedClass(ComponentHelper.java:837)
org.apache.tools.ant.ComponentHelper.getDataTypeDefinitions(ComponentHelper.java:365)
org.apache.tools.ant.Project.getDataTypeDefinitions(Project.java:942)
org.apache.tools.ant.types.AbstractFileSet.getDataTypeName(AbstractFileSet.java:309)
org.apache.tools.ant.types.AbstractFileSet.setupDirectoryScanner(AbstractFileSet.java:374)
org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:350)
org.apache.tools.ant.taskdefs.MatchingTask.getDirectoryScanner(MatchingTask.java:186)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:752)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

_________________
Regards,

Ahsan


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.