Here is a strange error I ran into, and a even more strange solution in the end.
I created a simple web service that publishes JMS messages to a queue. I used the simple annotations like:
private ConnectionFactory connectionFactory;
private javax.jms.Queue queue;
when I deployed the project to Weblogic, I got exceptions like:
"Dependency injection failure: can't find the bean definition about class interface javax.jms.Queue; nested exception is com.bea.core.repackaged.springframework.beans.factory.NoSuchBeanDefinitionException:
No unique bean of type [javax.jms.Queue] is defined: No beans of type javax.jms.Queue;"
The error description indicates the 2nd resource has problem. I finessed with various forms of the annotation, and simply couldn't get around it.
At one point, I managed to work around the issue by removing the annotated resource, and hard code the queue like:
InitialContext ctx = new InitialContext();
javax.jms.Queue queue = (Queue) ctx.lookup("foo.jms.bar.queue");
however, I don't like the hard coded work-around. Frustrated, I rebooted Weblogic server. To my surprise, that took care of the problem!
I have no explaination why rebooting would fix the problem. Nor do I know if this may help the same problem for other people.
The moral of the story is - do not always trust those silly error messages. They can lead you to a wild chase. In the end, a mere magic reboot would take care of the problem.