-->
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.  [ 4 posts ] 
Author Message
 Post subject: Works until jar'ed up!
PostPosted: Thu May 04, 2006 2:57 pm 
Beginner
Beginner

Joined: Tue Sep 27, 2005 2:51 pm
Posts: 27
My Stuff works great until I .jar it up, then there is an error "entity class not found"
The full message is
Code:
com.thomson.west.foundations.daos.HibernateUtil Initial SessionFactory creation failed.entity class not found: com.thomson.west.foundations.traudit.TrAuditValueVO

But as I said, if the classes are not jar'ed up then there is not a problem

Any assistence would be greatly appreciated!

Dave Ziebol
Hibernate version: 3.1
Eclipse 3.1
Jdk 1.4.2
Axis2 v1 RC4

Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping schema="j3_foundations_dba" package="com.thomson.west.foundations.traudit" default-cascade="all">
    <class name="TrAuditValueVO" table="tracked_value">
        <id name="valueId" column="value_id" unsaved-value="null" type="long">
      <generator class="increment"/>
        </id>
        <property name="eventId" type="long" column="event_id" not-null="true"/>
        <property name="preferedTypeId" type="integer" column="perf_type_id" not-null="true"/>
        <property name="valueName" type="string" column="value_name" not-null="false"/>
        <property name="numericValue" type="big_decimal" column="numeric_value"/>
        <property name="stringValue" type="string" column="str_value" not-null="false"/>
        <property name="dateValue" type="calendar" column="datetime_value" not-null="false"/>
        <property name="booleanValueC" type="character" column="boolean_value" not-null="false"/>
        <property name="isInterestedValueC" type="character" column="interested_value" not-null="false" />
        <property name="isClobC" type="character" column="is_clob" not-null="false"/>
   
     <!-- Add in the mapping to the clob value -->
     <one-to-one name="clobValue" class="com.thomson.west.foundations.traudit.ClobValueVO" cascade="all" constrained="false" fetch="select"/>
   </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Never get past the following:
Code:
          sessionFactory = new Configuration().configure()
           .addClass(com.thomson.west.foundations.FoundationsOnWhatVO.class)
           .addClass(AppPropertyVO.class)
           .addClass(TrAuditEventTypeVO.class)
           .addClass(TrAuditEventVO.class)
           .addClass(ClobValueVO.class)
           .addClass(PropertyValueVO.class)
           .addClass(XPropertyVO.class)
           .addClass(ErrorValueVO.class)
           .addClass(ApplicationImpl.class)
           .addClass(com.thomson.west.foundations.security.server.AppFunctionalityVO.class)
           .addClass(FunctionalityVO.class)
           .addClass(RequiredRoleVO.class)
           .addClass(com.thomson.west.foundations.security.server.AppFuncReqRoleVO.class)
           .addClass(ErrorEventVO.class)
           .addClass(AppEventVO.class)
           .addClass(com.thomson.west.foundations.traudit.TrAuditValueVO.class)
           .buildSessionFactory();


Full stack trace of any exception that occurs:
Code:
ERROR in daos.HibernateUtil.<clinit>():lINE:264 - msg=com.thomson.west.foundatio
ns.daos.HibernateUtil Initial SessionFactory creation failed.entity class not fo
und: com.thomson.west.foundations.traudit.TrAuditValueVO
org.hibernate.MappingException: entity class not found: com.thomson.west.foundat
ions.traudit.TrAuditValueVO
        at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.
java:99)
        at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:16
6)
        at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyF
actory.java:44)
        at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:115)
        at org.hibernate.persister.entity.AbstractEntityPersister.<init>(Abstrac
tEntityPersister.java:411)
        at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(Sing
leTableEntityPersister.java:108)
        at org.hibernate.persister.PersisterFactory.createClassPersister(Persist
erFactory.java:55)
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
217)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1145)
        at com.thomson.west.foundations.daos.HibernateUtil.<clinit>(HibernateUti
l.java:79)
        at com.thomson.west.foundations.daos.DBDAO.<init>(DBDAO.java:54)
        at com.thomson.west.foundations.daos.DBDAOFactory.createDAO(DBDAOFactory
.java:52)
        at com.thomson.west.foundations.daos.DAOFactoryBuilder.getRetrievalDAO(D
AOFactoryBuilder.java:109)
        at com.thomson.west.foundations.transport.AppDBInitVisitor.retrieveApp(A
ppDBInitVisitor.java:62)
        at com.thomson.west.foundations.transport.AppDBInitVisitor.initialize(Ap
pDBInitVisitor.java:40)
        at com.thomson.west.foundations.transport.AppDBInitVisitor.visit(AppDBIn
itVisitor.java:150)
        at com.thomson.west.foundations.context.ApplicationImpl.accept(Applicati
onImpl.java:874)
        at com.thomson.west.foundations.transport.AppDBInitVisitor.retrieveUniqu
e(AppDBInitVisitor.java:164)
        at com.thomson.west.foundations.transport.ServerTransportBuilder.getApp(
ServerTransportBuilder.java:73)
        at com.thomson.west.foundations.server.FoundationServicesServer.retrieve
Unique(FoundationServicesServer.java:293)
        at com.thomson.west.foundations.server.FoundationServicesServer.<init>(F
oundationServicesServer.java:55)
        at com.thomson.west.foundations.soap.FoundationServicesServerServiceSkel
eton.retrieveUnique(FoundationServicesServerServiceSkeleton.java:54)
        at com.thomson.west.foundations.soap.FoundationServicesServerServiceMess
ageReceiverInOut.invokeBusinessLogic(FoundationServicesServerServiceMessageRecei
verInOut.java:57)
        at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(A
bstractInOutSyncMessageReceiver.java:37)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:450)
        at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq
uest(HTTPTransportUtils.java:297)
        at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:1
64)
        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(Appl
icationFilterChain.java:237)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:214)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
ContextValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:152)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:137)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:118)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:102)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:16
0)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:799)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:683)
        at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.ClassNotFoundException: com.thomson.west.foundations.traudi
t.TrAuditValueVO
        at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClas
sLoader.java:854)
        at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClas
sLoader.java:721)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)

        at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.
java:96)
        ... 52 more


Name and version of the database you are using:
Oracle 10g
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

_________________
Dave Ziebol


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 4:12 pm 
Regular
Regular

Joined: Wed Aug 25, 2004 6:23 am
Posts: 91
That sounds like some sort of classpath issue or a problem with your JAR file.

Does running

Code:
jar -tvf <<jarfilename>>


produce sensible results?

if so, try starting java with the -verbose:class option - that can be helpful in tracking this kind of thing down too.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 5:34 pm 
Beginner
Beginner

Joined: Tue Sep 27, 2005 2:51 pm
Posts: 27
Tried the jar -tvf <<jarfilename>> and sent the output to a file. The class which is listed as not found is in the output file as well as the .hbm.xml associated with the class.

Odd part is that the other classes referenced via .addClass() calls can be found and they are all in the same jar file.

I'm thinking either there is an issue with the .hbm for this class:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping schema="j3_foundations_dba" package="com.thomson.west.foundations.traudit" default-cascade="all">
    <class name="TrAuditValueVO" table="tracked_value">
        <id name="valueId" column="value_id" unsaved-value="null" type="long">
      <generator class="increment"/>
        </id>
        <property name="eventId" type="long" column="event_id" not-null="true"/>
        <property name="preferedTypeId" type="integer" column="perf_type_id" not-null="true"/>
        <property name="valueName" type="string" column="value_name" not-null="false"/>
        <property name="numericValue" type="big_decimal" column="numeric_value"/>
        <property name="stringValue" type="string" column="str_value" not-null="false"/>
        <property name="dateValue" type="calendar" column="datetime_value" not-null="false"/>
        <property name="booleanValueC" type="character" column="boolean_value" not-null="false"/>
        <property name="isInterestedValueC" type="character" column="interested_value" not-null="false" />
        <property name="isClobC" type="character" column="is_clob" not-null="false"/>
   
     <!-- Add in the mapping to the clob value -->
     <one-to-one name="clobValue" class="com.thomson.west.foundations.traudit.ClobValueVO" cascade="all" constrained="false" fetch="select"/>
   </class>
</hibernate-mapping>


Or there is an issue someplace else and this class is getting blamed for the issue.

These are SO much fun to correct.

Thanks for your suggestion!

Dave Ziebol

_________________
Dave Ziebol


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 05, 2006 11:18 am 
Beginner
Beginner

Joined: Tue Sep 27, 2005 2:51 pm
Posts: 27
Ok, I think I have this figured out. Issue was the use of Hibernate IN Axis2. I found the following
Quote:
I run hibernate with axis2. The structure of the aar, for example, is:

.
./META-INF
./META-INF/MANIFEST.MF
./META-INF/SWAWiseEndpoint.wsdl
./META-INF/services.xml
./com
./com/siemens
./com/siemens/swa
./com/siemens/swa/webservices
./com/siemens/swa/webservices/wisemobil
./com/siemens/swa/webservices/wisemobil/SWAWiseEndpointSkeleton.class

Where the services.xml has:

<parameter locked="false"
name="ServiceClass">com.siemens.swa.webservices.wisemobil.SWAWiseEndpointSkeleton</parameter>

So every other class reference - hibernate, spring, business logic classes
etc, are either referenced in WEB-INF/lib or WEB-INF/classes . Your hibernate
or spring config files belong at the root of WEB-INF . AFAIK nothing else is
currently supported. While an AAR has its own classloader, things like spring
and perhaps hibernate use the 'context classloader' (CCL) which is not
currently supported in an AAR.

Its as simple as that. AFAIK you can place any jar in the AAR lib directory,
provided it doesn't use the CCL. The CCL can't load service resources in an
AAR and AFAIK currently is not supported.

HTH,
Robert
http://www.braziloutsource.com/

Em Sexta 10 Março 2006 07:59, o nancy escreveu:
> Hi,
>
> In continuation to my last mail,I am having one more problem.I want to load
> classes for hibernate,but it can't locate the xml files or any class from
> aar archive.But when I give jar file of my classes,it loads all the classes
> and .hbm.xml file.
> I cant understand the problem.Why it si doing like this.Please help!!.
>

found this at
http://mail-archives.apache.org/mod_mbox/ws-axis-user/200603.mbox/%3C200603101324.38373.robertlazarski@gmail.com%3E

So apparently if you wish to use Hibernate in Axis2 - then you don't deploy your service jar with your service.aar. You have to put them in the Axis2\WEB-INF\lib folder and your hibernate.properties seems to be picked up in the Axis2\WEB-INF\classes area.

Also note to put the hibernate.jar file in the Axis2\WEB-INF\lib folder

This is working for me (for the time being)

Hope this helps others!

Dave Ziebol

_________________
Dave Ziebol


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