jboss7 jndi mysql,JBoss 7.1-声明数据源并通过JNDI访问

I'am trying to migrate websphere 7 to JBoss 7.1 and i have several problem to configure my datasource, here is my whole config(database is oracle 10g) :

Jboss deployement looks fine

JBAS010400: Bound data source [jboss/datasources/xx3_oracle_tu_2]

My standalone-full.xml :

jdbc:oracle:thin:@************:1521:*****

oracle

UD1XXBD

*******

oracle.jdbc.OracleDriver

Seems ok about oracle driver:

JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 1.0)

Here is my bean in spring xml file :

org.jboss.naming.remote.client.InitialContextFactory

remote://localhost:4447

user

******

false

org.jboss.ejb.client.naming

The only error i have is :

Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: jboss/datasources/xx3_oracle_tu_2 -- service jboss.naming.context.java.jboss.exported.jboss.datasources.xx3_oracle_tu_2

On Jboss web admin console, no problems datasource appears.

Also with jboss-cli script and this command line, everything seems ok :

jboss-cli.bat -c --command=/subsystem=datasources/data-source=xx3_oracle_tu_2:test-connection-in-pool

{

"outcome" => "success",

"result" => [true]

}

I don't understand why this command line does not work :

jboss-cli.bat -c --command=/subsystem=datasources/data-source=java\:jboss\/datasources\/xx3_oracle_tu_2:test-connection-in-pool

Am i missing something about JBoss 7.1 JNDI configuration ?

Thanks by advance for your help !

EDIT : don't declare jboss/datasources and declare it like this in your standalone file and jboss-web file:

java:/xx3_oracle_tu_2

解决方案

AFAIK That command doesn't accept full JNDI references, it expects a datasource name.

You can view your datasource names with

/subsystem=datasources:read-resource(recursive=true)

Edit: ok, so the problem you have is with remote lookup.

If you look at this thread, you can see that unfortunately:

Remote lookup of datasources is not supported in AS7.

Edit2: so you're not doing a remote lookup after all.

Both this:

jndi-name="java:jboss/datasources/xx3_oracle_tu_2"/>

and this:

should do. JNDI env property you should not use, that's meant for remote lookups.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值