ich habe folgende xml um meine mysql db als datasource zur verfügung zu stellen:
<datasources> <local-tx-datasource> <!-- This connection pool will be bound into JNDI with the name "java:/MySQLDB" --> <jndi-name>localhostDB</jndi-name> <connection-url>jdbc:mysql://localhost:3306/web_portal</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>jboss</user-name> <password>123</password> <min-pool-size>5</min-pool-size> <!-- Don't set this any higher than max_connections on your MySQL server, usually this should be a 10 or a few 10's of connections, not hundreds or thousands --> <max-pool-size>20</max-pool-size> <!-- Don't allow connections to hang out idle too long, never longer than what wait_timeout is set to on the server...A few minutes is usually okay here, it depends on your application and how much spikey load it will see --> <idle-timeout-minutes>5</idle-timeout-minutes> <!-- If you're using Connector/J 3.1.8 or newer, you can use our implementation of these to increase the robustness of the connection pool. --> <exception-sorter-class-name> com.mysql.jdbc.integration.jboss.ExtendedMysq lExceptionSorter </exception-sorter-class-name> <valid-connection-checker-class-name> com.mysql.jdbc.integration.jboss.MysqlValidCo nnectionChecker </valid-connection-checker-class-name> </local-tx-datasource> </datasources>
wenn ich allerdings per
dataSource = null; InitialContext initCtx = new InitialContext(); Context ctx = (Context) initCtx.lookup("java:comp/env"); dataSource = (DataSource) ctx.lookup("java:/localhostDB");
versuche eine connection zu bekommen bekomme ich eine Exception
" javax.naming.NameNotFoundException: localhostDB not bound"
im serverlog sehe ich allerdings:
" INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=local
hostDB' to JNDI name 'java:localhostDB'
"
habe ich was übersehen?
greetz skelle