Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The attribute lookup is undefined for the annotation type Resource

Giving JMS a first shot, when I try to inject @Resource(lookup="jms/ConnectionFactory"), I get the error:

The attribute lookup is undefined for the annotation type Resource

I just read How to use java ee 6 @Resource annotation, but I haven't study Maven yet, so I was wondering, if I can fix this issue some other way rather than using Maven?

I'm using Eclipse by the way.

like image 573
Rehme Avatar asked Oct 14 '25 19:10

Rehme


2 Answers

The right fix for this is to right-click your project in Eclipse, Java Build Path -> Order and Exports, select JRE System Library and click on Bottom.

like image 145
Shivan Dragon Avatar answered Oct 17 '25 11:10

Shivan Dragon


Try using the mappedName attribute as:

@Resource(mappedName="jms/ConnectionFactory")

Also if you still want to use lookup, then take a look at the javax.annotation.jar you are using. Lookup attribute was introduced in JavaEE 6. Probably you have an older version.

like image 22
gipsh Avatar answered Oct 17 '25 11:10

gipsh