-->
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.  [ 10 posts ] 
Author Message
 Post subject: XML mapping won't compile on JBoss
PostPosted: Wed Jun 02, 2004 7:41 am 
Beginner
Beginner

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

I've been trying to get Hibernate solution to deploy on JBoss for several weeks, but no luck yet. The xml compiler can't seem to find the persistent class which corresponds to the mapping resource. Can anyone tell me what a common cause would be?



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 looks like this:
Code:
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 class name in CompanyHibernateImpl.hbm.xml:
<hibernate-mapping>
- <class name="com.kemaiev.jzudi.hibernate.CompanyHibernateImpl"


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 9:53 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
So look your error....
In your mapping file you have your package path for the class isnt'it?
And in your jboss-service.xml you have your package path more your directory classes/.
That's why during the mapping you can't find your classes... beacause you declare your package like com.toto.tata.XXX.class and you ask for classes.com.toto.tata.XXX.class.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 10:41 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
Yes, I have the following:

From CompanyHibernateImpl.hbm.xml:
Code:
<hibernate-mapping>
<class name="com.kemaiev.jzudi.hibernate.CompanyHibernateImpl"


but I have also tried:
Code:
<hibernate-mapping>
<class name="classes.com.kemaiev.jzudi.hibernate.CompanyHibernateImpl"

Niether worked.


Also,

From jboss-service.xml:
Code:
<attribute name="MapResources">
mappings/com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml
</attribute>


Am I missing something?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 3:19 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
But in your jboss-service.xml you have tried without classes.com..... or not?
Because you only need to use this com.mypackage..... into jboss-service.xml


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 5:32 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
The CompanyHibernateImpl.hbm.xml is located in:
mappings/com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml

CompanyHibernateImpl.hbm.xml does not exist in classes.com.... as I think you stated in the previous post.


If I don't include mappings/ in jboss-service.xml, then I get this error:

Code:
11:10:08,027 INFO  [Configuration] Mapping resource: com/kemaiev/jzudi/hibernate
/UnternehmenHibernateImpl.hbm.xml
11:10:08,037 INFO  [HibernateServiceMBean] Could not build SessionFactory using
the MBean classpath - will try again using client classpath: Resource: com/kemai
ev/jzudi/hibernate/UnternehmenHibernateImpl.hbm.xml not found   


Remember, the Ant task jbossservice writes 'com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml to jboss-service.xml automatically. However, I use Ant's replacefilter to add the mappings/ to the path.

Did I misunderstand your post? I'm sorry if I did.

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 5:41 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
I just noticed that I made a mistake on the last error posting. I forgot to change the name UnternehmenHibernateImpl.hbm.xml to CompanyHibernateImpl.hbm.xml for the post. I've been changing it for this forum because some people might not like 'foreign' languages:(

This does not affect the problem, though.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 6:33 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
You said you had:

Code:
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


What you need is:

Code:
jZUDI-MiddleTier.ear
+- META-INF/application.xm
+- META-INF/jboss-app.xml
+- jZUDIHibernate.sar (archive)
| +- com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.hbm.xml
| +- com/kemaiev/jzudi/hibernate/CompanyHibernateImpl.class
| +- META-INF/MANIFEST.MF
| +- META-INF/jboss-service.xml



Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 8:08 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
...Well I think we understand nothing:)
So take the build.xml give with the example in the distribution of middlegenRC4.
With it all will be generated at the right place I hope:)
And retry the hibernate jboss tutorial step by step.

Good luck

TONIGHT IF MY ADSL LINE IS OK I CAN SEND YOU MY EXAMPLE.

GIVE ME YOUR EMAIL

SORRY FOR CAP MY KEYBOARD IS DEAD:(


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 1:23 pm 
Beginner
Beginner

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

I think your explanation solved my problem. I tried doing things that way originally, but kept getting the 'persistent class not found' error.

Now tracing back, I realize that the error was due to a missing Manifest.mf Class-Path entry for a jar containing the interface that my Hibernate class was implementing--it compiled fine, but MBean just couldn't find it.

By the way, I was using the tutorial at
http://www.hibernate.org/66.html

The tutorial seems to suggest placing hbm.xml files into a separate 'mapping' directory. That is why I mistakenly strayed down that path.


BTW-here is a DAO example that helped me. Maybe a merging between this example and the tutorial listed above would be good:
http://forum.hibernate.org/viewtopic.ph ... ight=jboss

In any case, it should be well structured and leave nothing ambiguous for newbies like me. It would probably save many weeks of start-up development time.

I'm no expert, but I'd gladly volunteer to write something...of course, with all the dumb questions I'd be asking in these forums, it probably wouldn't have much credibility:) Again, I'm just a newbie.

Thanks again and best wishes.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 17, 2004 5:36 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
Hello!!!
Suddenly anybody can help me.
I'am using hibernate with Jboss.
I have this structure in the hibernate.sar in server/default/deploy

co/edu/escuelaing/Usuario.class
mappings/Usuario.hbm.xml
META-INF/jboss-service.xml

and file jboss-service.xml it is:

<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,
name=HibernateFactory">
<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=SigmaDS</depends>
<!-- Make it deploy ONLY after DataSource had been started -->
<attribute name="MapResources">/mappings/Usuario.hbm.xml</attribute>
<attribute name="JndiName">java:/hibernate/HibernateFactory</attribute>
<attribute name="Datasource">java:/SigmaDS</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.PostgreSQLDialect</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
<attribute name="UseOuterJoin">false</attribute>
<attribute name="ShowSql">false</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
</mbean>
</server>

but when I run Jboss server, appears to me this:

17:43:13,576 INFO [Configuration] Mapping resource: mappings/Usuario.hbm.xml
17:43:13,597INFO [HibernateServiceMBean] Could not build SessionFactory using
the MBean classpath - will try again using client classpath: Resource: mappings/Usuario.hbm.xml not found

Thanks!!
Marcela Moreno


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