-->
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.  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: mapping compile can't find class during deployment
PostPosted: Wed May 26, 2004 11:36 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
Hi,

Does anyone know why a hibernate class can't be found while attempting to compile its respective mapping document (xml.hbm) during deployment?

I think the problem is due to classloading, but I don't know how to solve it. Everything else seems to deploy fine. I'd really appreciate any ideas...

Regards,
Itchy


More facts:
The class is located in a .jar, whereas the mapping document is within a .sar. Directory structures are identical.


The error message states:
ERROR [Configuration] Could not compile the mapping document net.sf.hibernate.MappingException: persistent class [com.kemaiev.jzudi.hibernate
.CompanyHibernateImpl] not found
at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84)
.........etc......



Also, within jboss-service.xml:
attribute name="MapResources"
com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml
attribute
Code:
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 26, 2004 11:43 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
Do you have deploy your mapping classes and jboss-service.xmlm in a sar archive?
You are using Jboss I think:) look into the tutorial.
Could you post your jboss-service.xml.?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 26, 2004 12:40 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
subich,

Thanks for replying to my post so quickly. To answer your question: yes, I am using JBoss...I should have mentioned that--sorry. I am using the tutorial at: http://www.hibernate.org/66.html Plus I've read WIKI and the Getting Started docs. Nothing helped yet, but I think I'm very close to a successful deploy. Here is how my directory structure looks:


1).jboss-service.xml is in the META-INF directory of Hibernate.sar.
2).com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml is in jZUDIHibernate.sar
3).com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.class is in jZUDIHibernate.jar
4).Hibernate.sar is in jZUDI-MiddleTier.ear
5).jboss-app.xml is in META-INF of jZUDI-Middle-Tier.ear


HERE IS THE jboss-service.xml:

Code:
<!-- Generated file - Do not edit! -->
-
   <server>
-
   <mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=Hibernate">
<depends>jboss.jca:service=RARDeployer</depends>
-
   <attribute name="MapResources">
com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml
</attribute>
<attribute name="JndiName">java:/jZUDIConnectionFactory</attribute>
<attribute name="Datasource">java:/jdbc/jZUDIDataSource</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.SAPDBDialect</attribute>
<attribute name="UseOuterJoin">true</attribute>
<attribute name="ShowSql">false</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
-
   <attribute name="TransactionManagerLookupStrategy">
net.sf.hibernate.transaction.JBossTransactionManagerLookup

</attribute>
</mbean>
</server>


HERE IS application.xml:

Code:
<application>
<display-name>jZUDI-MiddleTier</display-name>
<description>The jZUDI Business Components</description>
<!-- uses session beans to get to Hibernate POJOs -->
-
   <module>
-
   <web>
<web-uri/>
<context-root/>
</web>
</module>
<!-- Just session beans accessing hibernate -->
-
   <module>
<ejb>jZUDIFacadeEJB.jar</ejb>
</module>
-
   <module>
<java>jZUDIDAO.jar</java>
</module>
-
   <module>
<java>jZUDIHibernate.jar</java>
</module>
-
   <module>
<java>jZUDIHibernate.sar</java>
</module>
</application>



HERE IS jboss-app.xml:
Code:
I'm not convinced this is right.
<jboss-app>
<loader-repository>jZUDI-MiddleTier:loader=jZUDI-MiddleTier.ear</loader-repository>
-
   <module>
<service>jZUDIHibernate.sar</service>
</module>
</jboss-app>




HERE IS THE (almost) COMPLETE PRINTOUT:
I think the part in red is due to the hbm.xml not compiling in previous step (also listed in original post).

16:27:50,603 INFO [MainDeployer] Starting deployment of package: file:/F:/JBoss
323/server/default/deploy/jZUDI-MiddleTier.ear
16:27:50,683 INFO [EARDeployer] Init J2EE application: file:/F:/JBoss323/server
/default/deploy/jZUDI-MiddleTier.ear
16:27:51,965 INFO [SARDeployer] nested deployment: file:/F:/JBoss323/server/def
ault/tmp/deploy/tmp35300jZUDI-MiddleTier.ear-contents/jZUDIHibernate.sar-content
s/lib/cglib-2.0-rc2.jar
16:27:51,985 INFO [SARDeployer] nested deployment: file:/F:/JBoss323/server/def
ault/tmp/deploy/tmp35300jZUDI-MiddleTier.ear-contents/jZUDIHibernate.sar-content
s/lib/commons-collections-2.1.jar
16:27:52,035 INFO [SARDeployer] nested deployment: file:/F:/JBoss323/server/def
ault/tmp/deploy/tmp35300jZUDI-MiddleTier.ear-contents/jZUDIHibernate.sar-content
s/lib/commons-lang-1.0.1.jar
16:27:52,045 INFO [SARDeployer] nested deployment: file:/F:/JBoss323/server/def
ault/tmp/deploy/tmp35300jZUDI-MiddleTier.ear-contents/jZUDIHibernate.sar-content
s/lib/commons-logging-1.0.3.jar
16:27:52,125 INFO [SARDeployer] nested deployment: file:/F:/JBoss323/server/def
ault/tmp/deploy/tmp35300jZUDI-MiddleTier.ear-contents/jZUDIHibernate.sar-content
s/lib/dom4j-1.4.jar
16:27:52,135 INFO [SARDeployer] nested deployment: file:/F:/JBoss323/server/def
ault/tmp/deploy/tmp35300jZUDI-MiddleTier.ear-contents/jZUDIHibernate.sar-content
s/lib/ehcache-0.6.jar
16:27:52,285 INFO [SARDeployer] nested deployment: file:/F:/JBoss323/server/def
ault/tmp/deploy/tmp35300jZUDI-MiddleTier.ear-contents/jZUDIHibernate.sar-content
s/lib/hibernate2.jar
16:27:52,376 INFO [SARDeployer] nested deployment: file:/F:/JBoss323/server/def
ault/tmp/deploy/tmp35300jZUDI-MiddleTier.ear-contents/jZUDIHibernate.sar-content
s/lib/jcs-1.0-dev.jar
16:27:52,386 INFO [SARDeployer] nested deployment: file:/F:/JBoss323/server/def
ault/tmp/deploy/tmp35300jZUDI-MiddleTier.ear-contents/jZUDIHibernate.sar-content
s/lib/odmg-3.0.jar
16:27:54,128 INFO [HibernateServiceMBean] starting service at JNDI name: java:/
jZUDIConnectionFactory
16:28:22,168 INFO [HibernateServiceMBean] service properties: {hibernate.sessio
n_factory_name=java:/jZUDIConnectionFactory, hibernate.transaction.manager_looku
p_class=net.sf.hibernate.transaction.JBossTransactionManagerLookup, hibernate.di
alect=net.sf.hibernate.dialect.SAPDBDialect, hibernate.show_sql=false, hibernate
.use_outer_join=true, hibernate.transaction.factory_class=net.sf.hibernate.trans
action.JTATransactionFactory, hibernate.connection.datasource=java:/jdbc/jZUDIDa
taSource, jta.UserTransaction=UserTransaction}
16:28:22,228 INFO [Environment] Hibernate 2.1.2
16:28:22,228 INFO [Environment] hibernate.properties not found
16:28:22,238 INFO [Environment] using CGLIB reflection optimizer
16:28:22,269 INFO [Configuration] Mapping resource: com/kemaiev/jzudi/hibernate
/CompanyHibernateImpl.hbm.xml
16:28:22,859 ERROR [Configuration] Could not compile the mapping document
net.sf.hibernate.MappingException: persistent class [com.kemaiev.jzudi.hibernate
.CompanyHibernateImpl] not found
at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84)
....................................................................................
..............I editted-out rest of 'at' details here...................
....................................................................................

16:28:49,337 INFO [HibernateServiceMBean] Could not build SessionFactory using
the MBean classpath - will try again using client classpath: Error reading resou
rce: com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml

16:28:49,518 INFO [SessionFactoryObjectFactory] Factory name: java:/jZUDIConnec
tionFactory
16:28:49,518 INFO [NamingHelper] JNDI InitialContext properties:{}
16:28:49,748 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: jav
a:/jZUDIConnectionFactory
16:29:04,269 WARN [SessionFactoryObjectFactory] InitialContext did not implemen
t EventContext
16:29:04,289 INFO [EARDeployer] Started J2EE application: file:/F:/JBoss323/ser
ver/default/deploy/jZUDI-MiddleTier.ear
16:29:04,289 INFO [MainDeployer] Deployed package: file:/F:/JBoss323/server/def
ault/deploy/jZUDI-MiddleTier.ear


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 26, 2004 12:43 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
Oooops

'4).' should be jZUDIHibernate.sar is in jZUDI-MiddleTier.ear

and not

Hibernate.sar is in jZUDI-MiddleTier.ear


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 9:15 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
Ok now it works?? :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 10:06 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
subich,

Thanks for staying with me on this. No, unfortunately it still doesn't work. The 'Ooops' post was just to correct an error in the previous post. I didn't mean that I found the programming error.:(

In fact, I'm still getting the same error:

Code:
15:44:16,714 ERROR [Configuration] Could not compile the mapping document
net.sf.hibernate.MappingException: persistent class [com.kemaiev.jzudi.hibernate
.CompanyHibernateImpl] not found



The JZUDIHibernate.sar MANIFEST.MF looks like this:
Code:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.1
Created-By: 1.4.2_04-b05 (Sun Microsystems Inc.)
Class-Path: jZUDIHibernate.jar


Again, here is a better description of my directory structure:
Code:
jZUDI-MiddleTier.ear
+- META-INF/application.xm
+- META-INF/jboss-app.xml
+- jZUDIHibernate.jar (archive)
| +- com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.class
+- jZUDIHibernate.sar (archive)
| +- com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml
| +- META-INF/MANIFEST.MF
| +- META-INF/jboss-service.xml


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 10:53 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
Ok nice, I think I see the problem.
Normally, you should your class files in the sar archive when you use JBoss mBean services.
Try with an archive lihe this

Application.sar
+----->META-INF/application.xml
+----->META-INF/jboss-service.xml
+----->com/application/XXX.class
+----->mapping/com/application/XXX.hbm.xml


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 12:18 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
Wow! Using structure mapping/com/kemaiev/jzudi/hibernate
/CompanyHibernateImpl.hbm.xml makes a big difference. Now it seems to compile. Interestingly, it also compiles when the .class file is within jZUDIHibernate.jar, instead of placing it in jZUDIHibernate.sar. The result seems identical, as long as the mapping directory is added. Also, no MANIFEST.MF Class-Path is needed for this step. I'll keep experimenting with these things.

A small problem though. The new path isn't being picked-up in jboss-service.xml. It is still recording:

(from jboss-service.xml)

Code:
<attribute name="MapResources">
com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml
</attribute>


It should including 'mapping/' in front of com/... but the Ant-task doesn't pick-up change. It is causing a problem with creating the SessionFactory (See output below). In any case, THANKS SO MUCH FOR YOU HELP SO FAR! I don't think I would've figured the directory structure issue out on my own.

Itchy


The structure now looks like this:
jZUDI-MiddleTier.ear
+- META-INF/application.xm
+- META-INF/jboss-app.xml
+- jZUDIHibernate.jar (archive)
| +- com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.class
+- jZUDIHibernate.sar (archive)
| +- mapping/com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml
| +- META-INF/MANIFEST.MF
| +- META-INF/jboss-service.xml



Here is output:
Code:
17:43:13,576 INFO  [Configuration] Mapping resource: com/kemaiev/jzudi/hibernate
/CompanyHibernateImpl.hbm.xml
17:43:13,597INFO  [HibernateServiceMBean] Could not build SessionFactory using
the MBean classpath - will try again using client classpath: Resource: com/kemai
ev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml not found


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 28, 2004 5:23 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
I don't put my classes on a jar into a sar. I put all of them into the sar without a jar archive.
I think, I add nothin more in the manifest.
Sorry but I haven't got my laptop with me today.
I can look this tonight and give you a response soon.

Good luck.

Kind regards.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 28, 2004 5:26 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
another thing your last error is due to the jboss-service.xml change the path for the xml files.
When I depploy I use a directory mapping and I change the path in the jboss-service.xml.
Update your mapresources with your own path

<attribute name="MapResources">mappings/MasterAccount.hbm.xml,
mappings/SubAccount.hbm.xml,
mappings/Password.hbm.xml</attribute>


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 29, 2004 4:46 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
Thanks subich, that sounds like a good idea, but I'm travelling until Tuesday, so I can't try it until then. Have a good weekend!


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 30, 2004 10:28 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
Ok you're welcome.
Tell me if it's all right.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 01, 2004 11:19 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
Well, I'm finally back now. Changing the path in mBean does indeed help. It now finds the mapping file; however it doesn't find the class, even though I included it in the .sar. I experimented by adding a 'classes' directory in front of the package directory tree (see structure below). Then I changed the path in the mapping document to include the new 'classes' directory.

I've done everything I could think of--all possible combinations of directory structures/mappings, with and witout 'classes' directory, but it just doesn't seem to find the class. It is the same error from my original post, but perhaps for a different reason. I'd appreciate any suggestions :)

The output from deployment:
Code:
15:50:43,624 INFO  [Configuration] Mapping resource: mappings/com/kemaiev/jzudi/
hibernate/CompanyHibernateImpl.hbm.xml
15:50:44,125 ERROR [Configuration] Could not compile the mapping document
net.sf.hibernate.MappingException: persistent class [com.kemaiev.jzudi.hibernate
.CompanyHibernateImpl] not found
        at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84)





The structure now looks like this:
jZUDI-MiddleTier.ear
+- META-INF/application.xm
+- META-INF/jboss-app.xml
+- jZUDIHibernate.sar (archive)
| +- mapping/com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml
| +- classes/com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.class
| +- META-INF/MANIFEST.MF
| +- META-INF/jboss-service.xml


The path in mapping with 'classes' directory:
Code:
<hibernate-mapping>
-   <class name="classes.com.kemaiev.jzudi.hibernate.CompanyHibernateImpl"


The path in mapping without 'classes' directory:
Code:
<hibernate-mapping>
-   <class name="com.kemaiev.jzudi.hibernate.CompanyHibernateImpl"


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 3:54 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
On wich file you put these line?

<hibernate-mapping>
- <class name="com.kemaiev.jzudi.hibernate.CompanyHibernateImpl


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 5:04 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
It is included within:

+- jZUDIHibernate.sar
| +- mapping/com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml

and CompanyHibernateImpl.hbm.xml is generated automatically by the <hibernatedoclet task.


I'm working on it now...maybe I just overlooked something obvious? I'll post if I find the mistake.


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

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.