-->
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.  [ 9 posts ] 
Author Message
 Post subject: a issue of deploying the sar package on JBoss 4.0.0
PostPosted: Mon Sep 27, 2004 3:59 am 
Beginner
Beginner

Joined: Mon Sep 27, 2004 3:48 am
Posts: 23
Following the "Using Hibernate with JBoss" on http://www.hibernate.org/66.html ,
I created a sar package and deployed it to JBoss 4.0.0's default/deploy folder.

The sar package includes the following files:
/com/xx/hibernate/po/Teacher.class
/com/xx/hibernate/po/Student.class
/com/xx/hibernate/po/Book.class
/com/xx/hibernate/po/Teacher.hbm.xml
/com/xx/hibernate/po/Student.hbm.xml
/com/xx/hibernate/po/Book.hbm.xml
/hibernate.cfm.xml


and the file related to JBoss
/META-INF/jboss-service.xml


the /hibernate.cfm.xml looks like:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<!-- Generated file - Do not edit! -->

<hibernate-configuration>

   <!-- a SessionFactory instance listed as /jndi/name -->
   <session-factory>

      <!-- properties -->
      <property name="connection.datasource">java:/myHibernateSqlServerDB</property>
      <property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
      <property name="show_sql">true</property>
      <property name="use_outer_join">true</property>

      <!-- mapping files -->
      <mapping resource="com/xx/hibernate/po/Book.hbm.xml"/>
      <mapping resource="com/xx/hibernate/po/Student.hbm.xml"/>
      <mapping resource="com/xx/hibernate/po/Teacher.hbm.xml"/>
   </session-factory>

</hibernate-configuration>


the jboss-service.xml looks like:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>

<!-- Generated file - Do not edit! -->

<server>
   <mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=myHibernate">
       <depends>jboss.jca:service=RARDeployer</depends>
       <depends>jboss.jca:service=LocalTxCM,name=myHibernateSqlServerDB</depends>
       <attribute name="MapResources">com/xx/hibernate/po/Book.hbm.xml,com/xx/hibernate/po/Student.hbm.xml,com/xx/hibernate/po/Teacher.hbm.xml</attribute>
       <attribute name="JndiName">java:/HibernateFactory</attribute>
       <attribute name="Datasource">java:/myHibernateSqlServerDB</attribute>
       <attribute name="Dialect">net.sf.hibernate.dialect.SQLServerDialect</attribute>
       <attribute name="UseOuterJoin">true</attribute>
       <attribute name="ShowSql">true</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>


and the mssql-ds.xml looks like:
Code:
<datasources>
  <local-tx-datasource>
    <jndi-name>myHibernateSqlServerDB</jndi-name>
    <connection-url>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=hibernate;SelectMethod=cursor</connection-url>
    <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
    <user-name>sa</user-name>
    <password></password>
      <metadata>
         <type-mapping>MS SQLSERVER2000</type-mapping>
      </metadata>
  </local-tx-datasource>
</datasources>


When firing up the JBoss, I got a error message:

15:46:42,070 FATAL [DatasourceConnectionProvider] Could not find datasource: java:/myHibernateSqlServerDB
javax.naming.NameNotFoundException: myHibernateSqlServerDB not bound


And if I removed the sar package from JBoss 4.0.0 's defaul/deploy folder, the Datasource just worked well.

So, why did the error happen when deploying my sar package???


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2004 6:44 am 
Beginner
Beginner

Joined: Fri Sep 24, 2004 8:18 am
Posts: 24
Hi,

I think you should remove this from your jboss-service.xml :
Code:
<depends>jboss.jca:service=LocalTxCM,name=myHibernateSqlServerDB</depends>


nusa.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2004 9:04 pm 
Beginner
Beginner

Joined: Mon Sep 27, 2004 3:48 am
Posts: 23
thanks, Nusa, I have tryed this, it didn't work and showed me the same error message.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2004 5:31 am 
Beginner
Beginner

Joined: Fri Sep 24, 2004 8:18 am
Posts: 24
Hi,

Please provide the version of Hibernate you're using and JBoss as well.

nusa.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2004 9:06 pm 
Beginner
Beginner

Joined: Mon Sep 27, 2004 3:48 am
Posts: 23
Hi, Nusa

I used the hibernate 2.1.5 shipped with the JBoss 4.0.0.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2004 4:19 am 
Beginner
Beginner

Joined: Fri Sep 24, 2004 8:18 am
Posts: 24
Hi,

Weird ...
When I deploy sybase-ds.xml, I got this :
Code:
08:56:22,530 DEBUG [org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Binding object 'org.jboss.resource.adapter.jdbc.WrapperDataSource@623367' into JNDI at 'java:SybaseDS'

08:56:22,530 INFO  [org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=SybaseDS,service=DataSourceBinding to JNDI name 'java:SybaseDS'


When you deploy your mssql-ds.xml, check if you got similar.

nusa.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2004 4:53 am 
Beginner
Beginner

Joined: Mon Sep 27, 2004 3:48 am
Posts: 23
Hi, Nusa

Here is the message I got from the JBoss 4.0.0 console:

Code:
16:51:57,203 INFO  [NamingHelper] JNDI InitialContext properties:{}
16:51:57,218 FATAL [DatasourceConnectionProvider] Could not find datasource: java:/myHibernateSqlServerDB
javax.naming.NameNotFoundException: myHibernateSqlServerDB not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:529)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:508)
        at javax.naming.InitialContext.lookup(InitialContext.java:347)
        at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:44)
        at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
        at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:65)
        at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1132)
        at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:766)
        at net.sf.hibernate.jmx.HibernateService.buildSessionFactory(HibernateService.java:176)
        at net.sf.hibernate.jmx.HibernateService.start(HibernateService.java:145)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:908)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start(ServiceController.java:416)
        at org.jboss.system.ServiceController.start(ServiceController.java:438)
        at org.jboss.system.ServiceController.start(ServiceController.java:438)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
        at $Proxy4.start(Unknown Source)
        at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:935)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:746)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
        at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:119)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
        at $Proxy8.deploy(Unknown Source)
        at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
        at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:481)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:277)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start(ServiceController.java:416)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
        at $Proxy4.start(Unknown Source)
        at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:935)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:746)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:693)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:119)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
        at $Proxy5.deploy(Unknown Source)
        at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:396)
        at org.jboss.system.server.ServerImpl.start(ServerImpl.java:293)
        at org.jboss.Main.boot(Main.java:151)
        at org.jboss.Main$1.run(Main.java:405)
        at java.lang.Thread.run(Thread.java:534)
16:51:57,500 INFO  [HibernateServiceMBean] Could not build SessionFactory using the MBean classpath - will try again using cl
ient classpath: Could not find datasource
16:51:57,546 INFO  [SessionFactoryObjectFactory] Factory name: java:/HibernateFactory
16:51:57,546 INFO  [NamingHelper] JNDI InitialContext properties:{}
16:51:57,546 INFO  [SessionFactoryObjectFactory] Bound factory to JNDI name: java:/HibernateFactory
16:51:57,546 WARN  [SessionFactoryObjectFactory] InitialContext did not implement EventContext
16:51:57,593 INFO  [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:
name=myHibernateSqlServerDB,service=DataSourceBinding to JNDI name 'myHibernateSqlServerDB'


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 30, 2004 4:00 am 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
Hi,

and you also added the JDBC jar of your driver to the lib directory of your jboss server ? I know you mentioned that your datasource worked well when you not deployed the sar archive, but how did you ensure that it worked ?

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 30, 2004 5:49 am 
Beginner
Beginner

Joined: Mon Sep 27, 2004 3:48 am
Posts: 23
Sure, I added the all required jar files to default/lib folder.
Now I encountered the same issure when deploying Har package in Jboss 4.0.0.


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