Trouble injecting resources with Java EE 6 and Glassfish 3.1 using @Resource

后端 未结 1 1075
旧巷少年郎
旧巷少年郎 2020-12-20 00:58

I\'m having trouble trying to use the @Resource annotation with Java EE 6 and Glassfish 3.1 (embedded). I want to look up a JNDI datasource, so I\'m trying to get it workin

相关标签:
1条回答
  • 2020-12-20 01:13

    As a test, can you try "jdbc/__default" as the lookup string? For my datasources I look them up using a jndi name I have specified, always with the pattern "jdbc/MyDataSourceName".

    @Resource(lookup="jdbc/MyDataSourceName") works well. Never tried to look up the default ds, particularly not through the java:global namespace.

    0 讨论(0)
提交回复
热议问题