4 Replies Latest reply on Jul 28, 2009 4:12 AM by Ondrej Medek

    @EJB injection in JSP and JSP change

    Ondrej Medek Apprentice

      Hi, I have in my JSP

      <!%
       @EJB
       Library lib;
      %>
      


      It works fine when I deploy/redeploy the application. But when I just change the JSP page and reload it in the browser, I got the exception

      java.lang.IllegalArgumentException: failed to set value Proxy to jboss.j2ee:ear=books-ear.ear,jar=books-ejb.jar,name=LibraryBean,service=EJB3 implementing [interface cz.root.jboss.library.Library] on field cz.root.jboss.library.Library org.apache.jsp.search_jsp.lib; Reason: ClassLoaders of value and target are not equal
       org.jboss.injection.lang.reflect.FieldBeanProperty.set(FieldBeanProperty.java:100)
       org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:119)
       org.jboss.web.tomcat.service.TomcatInjectionContainer.processInjectors(TomcatInjectionContainer.java:366)
       org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:271)
       org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:265)
       org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
      


      My application EAR with EJB JAR and WAR:
      books-ear
       +-- books-ejb.jar
       +-- books-war.war
       +-- META-INF
      


      JSP pages are in books-war.war and all EJBs with interfaces are in books-ejb.jar. The WAR has no Java class or any JAR.

      Do I miss something, e.g. do I have to set classloader?

      Thanks
      Andy