-->
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.  [ 7 posts ] 
Author Message
 Post subject: How to generate jboss-service.xml
PostPosted: Wed Jul 06, 2005 1:12 am 
Beginner
Beginner

Joined: Fri Feb 27, 2004 3:49 am
Posts: 25
Hi,

I need you help!

I used hibernate2 and run my application on jboss-3.2.5. The application can run properly. Now i try to switch to hibernate3 and jboss-4.0.2. The jboss can't setup properly. I found that my build.xml(ant) alwalys generate wrong jboss-service.xml.(XDoclet-1.2.4 is used). below is path of my build.xml and jboss-service.xml

build.xml

<target name="generate.hibernate" depends="init"
description="Generates Hibernate class descriptor files.">

<taskdef name="hibernatedoclet"
classname="xdoclet.modules.hibernate.HibernateDocletTask">
<classpath refid="hibernate.classpath"/>
</taskdef>

<taskdef name="jbossservice"
classname="xdoclet.modules.hibernate.JBossServiceSubTask">
<classpath refid="hibernate.classpath"/>
</taskdef>

<hibernatedoclet
destdir="${build.class.main}"
excludedtags="@version,@author,@todo"
force="true"
mergedir="${source.resources}/sar/hibernate"
verbose="true">

<fileset dir="${source.main}">
<include name="**/model/*.java"/>
</fileset>

<hibernate version="3.0"/>

<jbossservice
destdir="${source.resources}/sar/hibernate"
serviceName="Hibernate"
jndiName="java:/HibernateFactory"
dataSource="java:MySqlDSSMS"
dialect="org.hibernate.dialect.MySQLDialect"
showsql="true"
useOuterJoin="true"
transactionManagerStrategy="org.hibernate.transaction.JBossTransactionManagerLookup"
transactionStrategy="org.hibernate.transaction.JTATransactionFactory"
userTransactionName="UserTransaction"
username="admin"
password="admin"
/>

</hibernatedoclet>

<replace dir="${build.class.main}">
<include name="*.hbm.xml"/>
<replacefilter token="readonly" value="inverse"/>
<replacefilter token="role" value="name"/>
<replacefilter token="hibernate-mapping.dtd" value="hibernate-mapping-2.0.dtd"/>
</replace>

</target>

jboss-service.xml
<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=Hibernate">
<depends>jboss.jca:service=RARDeployer</depends>
<attribute name="MapResources">test.hbm.xml</attribute>
<attribute name="JndiName">java:/HibernateFactory</attribute>
<attribute name="Datasource">java:MySqlDSSMS</attribute>
<attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
<attribute name="UserName">admin</attribute>
<attribute name="Password">admin</attribute>
<attribute name="UseOuterJoin">true</attribute>
<attribute name="ShowSql">true</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
<attribute name="TransactionStrategy">org.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
</mbean>

</server>

?? why mbean code always like net.sf.hibernate.jmx.HibernateService no org.hibernate.jmx.HibernateService?

how to solve it? thanks!


Top
 Profile  
 
 Post subject: an observation
PostPosted: Sat Jul 09, 2005 4:20 am 
Newbie

Joined: Sat Jul 09, 2005 3:57 am
Posts: 1
Location: USA
Not that I know exactly how to solve your issue (other than tell you to generate your jboss-service.xml by hand :)

I appears that hibernate 3.0 had major package refactoring from net.sf.* to org.hibernate.

The generator tools you're using probably relies on the hibernate2.0 which is included with jboss 4.0.1sp1 (probably 0.2 also). And therefore generates class names based on the version 2 package architectue.

I was contemplating switching to hibernate 3.0 also so if you get it to work that will be great to know ;-)


-Hung the barbarian programmer.


Top
 Profile  
 
 Post subject: Re: How to generate jboss-service.xml
PostPosted: Tue Jan 10, 2006 2:15 am 
Newbie

Joined: Tue Jan 10, 2006 2:12 am
Posts: 1
[quote="tingling"]Hi,

I need you help!

I used hibernate2 and run my application on jboss-3.2.5. The application can run properly. Now i try to switch to hibernate3 and jboss-4.0.2. The jboss can't setup properly. I found that my build.xml(ant) alwalys generate wrong jboss-service.xml.(XDoclet-1.2.4 is used). below is path of my build.xml and jboss-service.xml

build.xml

<target name="generate.hibernate" depends="init"
description="Generates Hibernate class descriptor files.">

<taskdef name="hibernatedoclet"
classname="xdoclet.modules.hibernate.HibernateDocletTask">
<classpath refid="hibernate.classpath"/>
</taskdef>

<taskdef name="jbossservice"
classname="xdoclet.modules.hibernate.JBossServiceSubTask">
<classpath refid="hibernate.classpath"/>
</taskdef>

<hibernatedoclet
destdir="${build.class.main}"
excludedtags="@version,@author,@todo"
force="true"
mergedir="${source.resources}/sar/hibernate"
verbose="true">

<fileset dir="${source.main}">
<include name="**/model/*.java"/>
</fileset>

<hibernate version="3.0"/>

<jbossservice
destdir="${source.resources}/sar/hibernate"
serviceName="Hibernate"
jndiName="java:/HibernateFactory"
dataSource="java:MySqlDSSMS"
dialect="org.hibernate.dialect.MySQLDialect"
showsql="true"
useOuterJoin="true"
transactionManagerStrategy="org.hibernate.transaction.JBossTransactionManagerLookup"
transactionStrategy="org.hibernate.transaction.JTATransactionFactory"
userTransactionName="UserTransaction"
username="admin"
password="admin"
/>

</hibernatedoclet>

<replace dir="${build.class.main}">
<include name="*.hbm.xml"/>
<replacefilter token="readonly" value="inverse"/>
<replacefilter token="role" value="name"/>
<replacefilter token="hibernate-mapping.dtd" value="hibernate-mapping-2.0.dtd"/>
</replace>

</target>

jboss-service.xml
<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=Hibernate">
<depends>jboss.jca:service=RARDeployer</depends>
<attribute name="MapResources">test.hbm.xml</attribute>
<attribute name="JndiName">java:/HibernateFactory</attribute>
<attribute name="Datasource">java:MySqlDSSMS</attribute>
<attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
<attribute name="UserName">admin</attribute>
<attribute name="Password">admin</attribute>
<attribute name="UseOuterJoin">true</attribute>
<attribute name="ShowSql">true</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
<attribute name="TransactionStrategy">org.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">org.hibernate.transaction.JBossTransactionManagerLookup</attribute>
</mbean>

</server>

?? why mbean code always like net.sf.hibernate.jmx.HibernateService no org.hibernate.jmx.HibernateService?

i am also having the same problem plz help me...


Top
 Profile  
 
 Post subject: Fix it like so ...
PostPosted: Mon Feb 13, 2006 2:05 pm 
Newbie

Joined: Mon Feb 13, 2006 1:56 pm
Posts: 2
Grab the xdoclet source, I'm using xdoclet-1.2.3.

Edit method public String serviceClassName(Properties attributes)
of file HibernateTagsHandler.java
in directory modules/hibernate/src/xdoclet/modules/hibernate

from

Code:
public String serviceClassName(Properties attributes)
    {
        if ("1.1".equals(getHibernateSubTask().getVersion()))
            return "cirrus.hibernate.jmx.HibernateService";
        else
            return "net.sf.hibernate.jmx.HibernateService";
    }


to

Code:
public String serviceClassName(Properties attributes)
    {
        if ("1.1".equals(getHibernateSubTask().getVersion()))
            return "cirrus.hibernate.jmx.HibernateService";
        else
            return "org.hibernate.jmx.HibernateService";
    }


then go to the root of the source tree and run ant
You should now have a proper xdoclet-hibernate-module-1.2.3.jar

You could probably add some more kinky version checking, but I'm not going back to hibernate2 so this is good enough for me.

Regards,
Conrad


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 8:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Create a job in XDoclets JIRA to fix this issue.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 5:27 am 
Newbie

Joined: Mon Feb 13, 2006 1:56 pm
Posts: 2
http://opensource2.atlassian.com/projec ... e/XDT-1481


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 7:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Thanks.


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