EJB Local invocation: Deploy the WebClient and EJB servers to the same jboss,client and server to communicate through a single JVM.
When the Web client is called locally. You need to refer to the EJB server-side packaged jar without referencing the jndi.properties file under the jar and SRC under jboss/client. The calling method is as follows:
<%@ page language= "java" import= "java.util.*,javax.naming.*,com.tgb.ejb.*" pageencoding= "Utf-8"%><%String Path = Request.getcontextpath (); String basepath = request.getscheme () + "://" + request.getservername () + ":" + request.getserverport () + path + "/";%>&L T;html>in the browser enter the URL address of the client advertisement, JBoss will report for example the following exception:
13:02:30,924 ERROR [[JSP]] Servlet.service () for Servlet JSP threw exceptionjava.lang.ClassCastException: $Proxy 96 Cannot is cast to Com.tgb.ejb.UserManagerat Org.apache.jsp.index_jsp._jspservice (index_jsp.java:79) at Org.apache.jasper.runtime.HttpJspBase.service (httpjspbase.java:70) at Javax.servlet.http.HttpServlet.service ( httpservlet.java:803) at Org.apache.jasper.servlet.JspServletWrapper.service (jspservletwrapper.java:373) at Org.apache.jasper.servlet.JspServlet.serviceJspFile (jspservlet.java:336) at Org.apache.jasper.servlet.JspServlet.service (jspservlet.java:265) at Javax.servlet.http.HttpServlet.service ( httpservlet.java:803) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter ( applicationfilterchain.java:290) at Org.apache.catalina.core.ApplicationFilterChain.doFilter ( applicationfilterchain.java:206) at Org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter ( replyheaderfilter.java:96) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter ( Applicationfilterchain.java:235) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:206) at Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:230) at Org.apache.catalina.core.StandardContextValve.invoke (standardcontextvalve.java:175) at Org.jboss.web.tomcat.security.SecurityAssociationValve.invoke (securityassociationvalve.java:182) at Org.jboss.web.tomcat.security.JaccContextValve.invoke (jacccontextvalve.java:84) at Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:127) at Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:102) at Org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke (cachedconnectionvalve.java:157) at Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:109) at Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:262) at Org.apache.coyote.http11.Http11Processor.process (http11processor.java:844) at Org.apache.coyote.http11.http11protocol$http11Connectionhandler.process (http11protocol.java:583) at Org.apache.tomcat.util.net.jioendpoint$worker.run ( jioendpoint.java:446) at Java.lang.Thread.run (thread.java:619)
Workaround: Locate the Jboss-service.xml file under the Jboss-4.2.3.ga\server\default\deploy\jboss-web.deployer\meta-inf path of the JBoss server and <attribute name= "Usejbosswebloader" >false</attribute> false to True, restart JBoss, problem solved. the usejbosswebloader property is set to True: Indicates that Tomcat uses JBoss's uniform class loader as the class loader for Web applications, which means that the war package is web-inf/ The classes in the classes and Web-inf/lib folders will be loaded into the default shared class loader repository. Through it. Enables classes and resources to be shared between Web applications. However, assuming this is not the case you want, you can avoid this behavior by setting the property to False.
In general, such situations should be avoided. Since the same classes and resources are available in different applications, there is a conflict between different jboss applications, such as the following: two war applications Wara,warb the following are com.tgb.User.class files; Now expect each war package to have the following separate User.class files, and when you change a Wara application, Tomcat deploys the following applications again. This time. The Wara application uses the user.class below Warb, causing confusion.
I hope my commentary can help you improve.
Resolve EJB Local Call "Java.lang.ClassCastException: $Proxy cannot be cast to Com.tgb.ejb.UserManager" exception