-->
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.  [ 2 posts ] 
Author Message
 Post subject: connecting to mySQL database withe Hibernate in JBoss AS
PostPosted: Tue Apr 26, 2005 1:12 pm 
Newbie

Joined: Tue Apr 19, 2005 11:33 am
Posts: 4
Hello every body,i'm working in aproject using eclipse jboss and hibernate,my jboss-service.xml present in G:\jboss-4.0.2RC1\server\default\deploy\jboss-hibernate.deployer\META-INF\ is the following
///////////////////jboss-service.xml////////////////////
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE server>

<server>
<!-- | HibernateService MBean for MySQL -->
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateSessionFactory">
<depends>jboss.jca:service=RARDeployer</depends>
<!--
<attribute name="MapResources">
mappings/Map.hbm
</attribute>
-->

<attribute name="JndiName">
java:/HibernateSessionFactory
</attribute>
<!--<attribute name="Datasource">java:/DefaultDS</attribute>-->
<attribute name="Dialect">
net.sf.hibernate.dialect.mySQLDialect
</attribute>
<attribute name="TransactionStrategy">
net.sf.hibernate.transaction.JTATransactionFactory
</attribute>
<attribute name="TransactionManagerLookupStrategy">
net.sf.hibernate.transaction.JBossTransactionManagerLookup
</attribute>
<attribute name="ShowSql">true</attribute>
<attribute name="CacheProvider">
net.sf.hibernate.cache.TreeCacheProvider
</attribute>
<attribute name="UserTransactionName">
UserTransaction
</attribute>
</mbean>
</server>


///////////////////////////////////////////////////////////////

the hibernate.cfg.xml file:


/////////////////////////hibernate.cfg.xml/////////////////////
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory >

<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:mysql://localhost/Base1</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<!-- property name="hibernate.connection.pool_size"></property -->

<!-- dialect for PostgreSQL -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>

<property name="hibernate.show_sql">false</property>
<property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<mapping resource="Map.hbm"/>
</session-factory>
</hibernate-configuration>
/////////////////////////////////////////////////////////////////
when i try to execute a client hows trying to insert in my data base i obtain in the eclipse console this error msg:

Buildfile: D:\eclipse\workspace\SIG\build.xml
prepare:
compile:
ejbjar:
run.MapManager:
[java] log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).
[java] log4j:WARN Please initialize the log4j system properly.
[java] %%%% Error Creating SessionFactory %%%%
[java] net.sf.hibernate.HibernateException: Could not locate TransactionManager
[java] at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:26)
[java] at net.sf.hibernate.transaction.JTATransactionFactory.configure(JTATransactionFactory.java:48)
[java] at net.sf.hibernate.transaction.TransactionFactoryFactory.buildTransactionFactory(TransactionFactoryFactory.java:48)
[java] at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:66)
[java] at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1155)
[java] at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:789)
[java] at sig.mapping.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:42)
[java] at sig.entreprise.MapManager.main(MapManager.java:8)
[java] Caused by: javax.naming.NameNotFoundException: TransactionManager not bound
[java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
[java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
[java] at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
[java] at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
[java] at sun.rmi.transport.Transport$1.run(Unknown Source)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at sun.rmi.transport.Transport.serviceCall(Unknown Source)
[java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
[java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
[java] at java.lang.Thread.run(Unknown Source)
[java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
[java] at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
[java] at sun.rmi.server.UnicastRef.invoke(Unknown Source)
[java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
[java] at javax.naming.InitialContext.lookup(Unknown Source)
[java] at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
[java] ... 7 more
[java] java.lang.NullPointerException
[java] at sig.mapping.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:49)
[java] at sig.entreprise.MapManager.main(MapManager.java:8)
[java] Exception in thread "main"
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 6 seconds

thonk you very mutch for your help


Top
 Profile  
 
 Post subject: response
PostPosted: Wed Apr 27, 2005 11:01 am 
Beginner
Beginner

Joined: Mon Apr 18, 2005 10:25 am
Posts: 38
Location: Maryland
Check to make sure you have all the required jar files. There are a number of them to include a logging jar.


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