Hi

openejb binds by default resource in openejb:Resource. We support java:app
and java:global namespaces as well but java:/jdbc is not portable.

you should even get a warn "invalid reference suffix"

FYI: https://issues.apache.org/jira/browse/TOMEE-1592



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-26 14:18 GMT+02:00 padou <[email protected]>:

> Hello,
>
> I have some unit test that works perfectly when I use
>
> @Resource ("jdbc/defaultDS")
> Datasource ds ;
>
> My project has been ported to jboss and I have to use:
>
> @Resource ("java:/jdbc/defaultDS")
> Datasource ds ;
>
> I fixed the code:
>
> from
> ...
> properties.put ("jdbc/DefaultDS", "new://Resource?type=DataSource");
> properties.put ("jdbc/DefaultDS.JdbcDriver", "org.h2.Driver");
> properties.put ("jdbc/DefaultDS.JdbcUrl",
> "jdbc:h2:mem:test;MODE=Oracle;MVCC=TRUE;AUTOCOMMIT=OFF;LOCK_MODE=3;LOG=2");
> ...
> to
>
> properties.put ("java:/jdbc/DefaultDS", "new://Resource?type=DataSource");
> properties.put ("java:/jdbc/DefaultDS.JdbcDriver", "org.h2.Driver");
> properties.put ("java:/jdbc/DefaultDS.JdbcUrl",
> "jdbc:h2:mem:test;MODE=Oracle;MVCC=TRUE;AUTOCOMMIT=OFF;LOCK_MODE=3;LOG=2");
>
> The datasource is not injected in the beans...
> I get:
> ....
> May 26, 2015 2:27:38 PM org.apache.openejb.config.ConfigurationFactory
> configureService
> INFO: Configuring Service(id=java:/jdbc/DefaultDS, type=Resource,
> provider-id=Default JDBC Database)
> ....
> INFO: Auto-linking resource-ref 'java:/jdbc/DefaultDS' in bean
> PermissionDAOBean to Resource(id=java:/jdbc/DefaultDS)
> May 26, 2015 2:27:44 PM org.apache.openejb.config.AutoConfig
> processResourceRef
> ...
> *May 26, 2015 2:27:44 PM org.apache.openejb.config.JndiEncInfoBuilder
> insert
> WARNING: Invalid referenceName suffix. name: java:/jdbc/DefaultDS.*
> ...
> WARNING: Injection data not found in JNDI context:
>
> jndiName='comp/env/test.persistency.impl.jaasgroup.PermissionDAOBean/dataSource',
> target=test.persistency.impl.jaasgroup.PermissionDAOBean/dataSource
> ...
> May 26, 2015 2:28:05 PM
> org.apache.openejb.core.transaction.EjbTransactionUtil
> handleSystemException
> SEVERE: EjbTransactionUtil.handleSystemException: null
> java.lang.NullPointerException
>         at
>
> test.persistency.impl.jaasgroup.PermissionDAOBean.getPermission(PermissionDAOBean.java:204)
> ....
>
> Any suggestions ?
>
> Pat
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/OpenEjb-Injection-of-datasource-using-jboss-naming-tp4675044.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Reply via email to