File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate config on JBOSS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate config on JBOSS" Watch "Hibernate config on JBOSS" New topic
Author

Hibernate config on JBOSS

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 382
I am using JBOSS 5 and Hibernate 3. I keep getting an error when I try to access the Session factory, "javax.naming.NameNotFoundException: DSDB not bound"

I assume my config is wrong somehow. Would you take a look?

Java Call:
SessionFactory sf = (SessionFactory) new InitialContext().lookup("java:/DSDB");

Hibernate.cfg.xml:

<session-factory name="java:/DSDB">
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="connection.datasource">java:/DSDB</property>
<property name="connection.username">stuff</property>
<property name="jndi.class"></property>
<property name="connection.password">stuff</property>
<property name="jndi.url">
jdbc:sqlserver://localhost:1433;databaseName=DS
</property>



server/default/deploy/DS-ds.xml

<?xml version="1.0" encoding="UTF-8"?>

<datasources>

<!-- JBOSS 5.1 Install in \server\default\deploy-->
<local-tx-datasource>
<jndi-name>DSDB</jndi-name>
<connection-url>jdbc:sqlserver://localhost:1433;databaseName=DS</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<user-name>stuff</user-name>
<password>stuff</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<use-java-context>false</use-java-context>
<track-statements/>
<new-connection-sql>SELECT 1</new-connection-sql>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<metadata>
<type-mapping>MS SQLSERVER2000</type-mapping>
</metadata>
</local-tx-datasource>

</datasources>


Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 513

It's typically java:xxx/name or java:env/xxx/name.
Can you please verify the jndi name in console after starting your jboss: http://localhost:8080/?
you can refer this thread for jndi naming conventions in jboss.


If you are not laughing at yourself, then you just didn't get the joke.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate config on JBOSS
 
Similar Threads
quartz scheduler problem
Problem in deploying multiple EARs in same JBOSS having same application and EJBs in all the EARs
jboss cmp sql server 2000
Not Finding DataSource in JNDI Tree
Transaction Management between two Data Center