• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate config on JBOSS

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>


 
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic