Hi!
I have a problem related to using local EJB (@Local) inside an MVC controller. This might be connected to the way Weblogic handles the @Local notation. Basically I have this interface:
Then I implement it this way:Code:package x.y.ejb.interfaces import javax.ejb.Local; @Local public interface MyServiceInterface{ void someMethod(); }
I have this configuration in servlet-context.xml:Code:package x.y.ejb.implementations import x.y.ejb.interfaces.MyServiceInterface; import javax.ejb.Stateless; @Stateless(mappedName="ejb/MyService") public class MyService implements MyServiceInterface{ void someMethod(){ System.out.println("Hello World!"); } }
Finally I have this controller:Code:<jee:local-slsb id="myService" jndi-name="ejb/MyService#x.y.ejb.interfaces.MyServiceInterface" business-interface="x.y.ejb.interfaces.MyServiceInterface" lookup-home-on-startup="true" resource-ref="false" />
When I deploy I get the following:Code:package x.y.web.controllers import x.y.ejb.interfaces.MyServiceInterface; @Controller public class MyController{ @Autowired private MyServiceInterface myServiceInterface; public void setMyServiceInterface(MyServiceInterface myServiceInterface) { this.myServiceInterface = myServiceInterface; } @RequestMapping(value = "/") public String home(Model model) { myServiceInterface.someMethod(); return "home"; } }
org.springframework.beans.factory.NoSuchBeanDefini tionException:No matching bean of type [x.y.ejb.interfaces.MyServiceInterface] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.
I tried to substitute @Local with @Remote (and of course jee:local-slsb with jee:remote-slsb) and it works fine. However I need to find a solution for the @Local case.


Reply With Quote
