[jboss-user] [JNDI/Naming/Network] - Using jndi from a web project

mornblues do-not-reply at jboss.com
Wed Jul 22 17:24:06 EDT 2009


I have a project which I want to deploy. It uses JSF for creating the interface and spring for bean handling. I can deploy it to tomcat 6.0.20 without problems, but I have JNDI issues when I try to do so in jboss 4.2.3.GA.

I use jndi to connect to the mysql database. If I set
<use-java-context>false</use-java-context>
in jboss-ds.xml then I can connect to it via
new InitialContext().lookup("myname");

Otherwise, if I set use-java-context to true, I cannot connect using:
new InitialContext().lookup("java:myname");
or using anything else, for that matter.

The error I get is:
anonymous wrote : PoolJDBCServiceLocator, method getConnection: Error resolving service: javax.naming.NameNotFoundException: jdbc not bound
Although, during the startup jboss announces:
anonymous wrote : INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=pCollecta' to JNDI name 'java:myname'

I'm not a JNDI expert, but reading jboss documentation regarding JNDI didn't get me any new insight. Maybe you can help me out or point me to some documentation that may teach me how to do this properly.

These are the other field in jboss-ds.xml which I have set:
<local-tx-datasource>
  |     <jndi-name>myname</jndi-name>
  |     <connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
  |     <driver-class>com.mysql.jdbc.Driver</driver-class>
  |     <user-name>x</user-name>
  |     <password>y</password>
  |     <min-pool-size>5</min-pool-size>
  |     <max-pool-size>20</max-pool-size>
  |     <idle-timeout-minutes>5</idle-timeout-minutes>
  | </local-tx-datasource>

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

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



More information about the jboss-user mailing list