-->
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.  [ 3 posts ] 
Author Message
 Post subject: Cannot find the datasource exception
PostPosted: Mon May 17, 2004 11:22 am 
Beginner
Beginner

Joined: Sun May 16, 2004 3:53 pm
Posts: 47
Location: Belo Horizonte, Brazil
Hi,
i'm getting the following exception when trying to access a datasource.

FATAL [DatasourceConnectionProvider] Could not find datasource: java:/hibernate_test
javax.naming.NameNotFoundException: hibernate_test not bound


As i'm a begginer with Hibernate, i have a lot of doubts - some of them i already posted in this forum, but every step i make, i get a new exception :-(

- Is the datasource the same as the connection url?

- I'm using hibernate2 as an mbean in jboss 3.2.3, so do i need the file hibernate.properties or just the jboss-service.xml ??? If i do, where should i pack it?

- I could run the example that comes with hibernate2 with the same database using the connection url like this: jdbc:mysql://localhost/hibernate_test. However, i also tried this on my app (instead of java:/hibernate_test) and it didn't work.

Here's jboss-service.xml
Code:
<server>
   <mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=Hibernate">
       <depends>jboss.jca:service=RARDeployer</depends>
       <attribute name="MapResources">hibernate/Person.hbm.xml</attribute>
       <attribute name="JndiName">java:/hibernate/SessionFactory</attribute>
       <attribute name="Datasource">java:/hibernate_test</attribute>
       <attribute name="Dialect">net.sf.hibernate.dialect.MySQLDialect</attribute>
       <attribute name="UseOuterJoin">false</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>


And here's part of my java code
Code:
Context ctx = new InitialContext();
SessionFactory factory = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory");
System.out.println("Found jndi ok !!! ");
Session session = factory.openSession();
System.out.println("Opened session ok !!! ");


The last line i see printed on screen is "Found jndi ok !!!".

Thanks,
ltcmelo


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 17, 2004 11:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No, datasource is not the same as connection URL. You have to have a datasource deployed in JBoss, there are some example xxx-ds.xml files around in the JBoss distribution, take a look.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 17, 2004 11:47 am 
Beginner
Beginner

Joined: Sun May 16, 2004 3:53 pm
Posts: 47
Location: Belo Horizonte, Brazil
Sure,
my bad.

Actually i had a wrong conection url for my datasource.

Thanks again,
ltcmelo


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