[jboss-user] [JBoss Portal] - Using JNDI datasource name in Hibernate

advaittrivedi do-not-reply at jboss.com
Thu Oct 18 01:50:20 EDT 2007


I have created a datasource in Jboss Portal 2.6.1. My test server is windows 2003 and jdk 1.5

  | <datasources>
  |   <local-tx-datasource>
  |     <jndi-name>jdbc/JbossDS</jndi-name>    <connection-url>jdbc:mysql://localhost:3306/jbossportaldb</connection-url>
  |     <driver-class>com.mysql.jdbc.Driver</driver-class>
  |     <user-name>jbossportal</user-name>
  |     <password>jbossportal</password>
  |   </local-tx-datasource>
  | </datasources>
  | 

I refer to this datasource in Hibernate.cfg.xml using this property:

  | <property name="connection.datasource">java:/jdbc/JbossDS</property>
  | 

But when I run my app it is giving this exception:
javax.naming.NameNotFoundException: jdbc not bound
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
	at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
	at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
	at javax.naming.InitialContext.lookup(InitialContext.java:351)
	at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
	at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
	at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
	at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:397)

Also I want to use PortalDS in hibernate.cfg.xml how can I do that? what will be the value of connection.datasource property?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4096373#4096373

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4096373



More information about the jboss-user mailing list