Hi, I'm new to jBoss AS and I'm trying to migrate a web application that almost worked on Tomcat 6.0.16 to jBoss 5 Beta4. The reason is that I realized Tomcat currently doesn't support resource injection and is somehow buggy... The application uses JPA to access one database and a datasource taken out from JNDI to access another database (but no other types of EJBs). The problem occurs when deploying the web archive:
| 09:02:31,896 ERROR [BaseModelMBean] Exception invoking method addChild | java.lang.RuntimeException: mapped-name is required for jdbc/[my-jndi-name] of deployment [my-war] | at org.jboss.injection.ResourceHandler.loadXmlResourceRefs(ResourceHandler.java:156) | at org.jboss.injection.ResourceHandler.loadXml(ResourceHandler.java:270) | at org.jboss.web.tomcat.service.TomcatInjectionContainer.processMetadata(TomcatInjectionContainer.java:348) | ... | I followed jBoss's guide to configure a data source in an xml file named mysql-ds.xml (in the "deploy" directory) that looks like this: | <datasources> | <local-tx-datasource> | <jndi-name>jdbc/[my-jndi-name]</jndi-name> | <connection-url>jdbc:mysql://[my-host]:3306/[my-db]</connection-url> | <driver-class>com.mysql.jdbc.Driver</driver-class> | <user-name>[my-username]</user-name> | <password>[my-password]</password> | <min-pool-size>5</min-pool-size> | <max-pool-size>20</max-pool-size> | <idle-timeout-minutes>5</idle-timeout-minutes> | <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> | <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name> | <new-connection-sql>SELECT 1</new-connection-sql> | <metadata> | <type-mapping>mySQL</type-mapping> | </metadata> | </local-tx-datasource> | </datasources> | I've also add the following fragment to the web.xml file: | <resource-ref> | <description>DB Connection</description> | <res-ref-name>jdbc/[my-jndi-name]</res-ref-name> | <res-type>javax.sql.DataSource</res-type> | <res-auth>Container</res-auth> | </resource-ref> | I found some documentation about mapped-name in the J2EE API docs, in the @Resource annotation class... but I'm confused about its usage. Do I have to use resource injection in order to make it work? Because that's not the case... I'm using plain JNDI coding: | ... | Context initialContext = new InitialContext(); | DataSource dataSource = (DataSource)initialContext.lookup(JNDI_CONNECTION_NAME); | connection = dataSource.getConnection(); | ... | Is there something obvious I'm missing? Do I have to configure an ejb-jar.xml and refactor my code to exclusively use stateless Beans and resource injection? Any help will be appreciated. Thanks, Jerome View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157237#4157237 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157237 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user