Error description:
Today, when a session bean is called Using JSP, a "Java. Lang. classcastexception: $ proxy65" error occurs. Baidu has explained the following in Chinese:
The default Web Loader of JBoss is false. According to the description in the configuration file, the purpose is to display multiple loaders, determine whether to use the JBoss Web Loader as a uniform loader by setting the real value. That is to say, if a specific loader is specified in the program, or other Tomcat jar packages are used in Lib, The JBoss built-in loader is set to flase, the jar and class files of the war package are not loaded by the JBoss loader.
Solution:
Change the default value of the JBoss Loader from false to true.
Solution details:
Modifying the jboss-4.2.3.GA file in the jboss-web.deployer/Server/default/deploy/META-INF/jboss-service.xml
Set the sejbosswebloader attribute to true (the default value is false ).
After modification:
<Attribute name = "usejbosswebloader"> true </attribute>
The following is an English explanation:
See classloadingconfiguration.
Available option in deploy/jbossweb-tomcat.sar/META-INF/jboss-service.xml
Or deploy/jboss-web.deployer/META-INF/jboss-service.xml
This configuration options toggles usage of separate classloaders for web modules. The JBoss uniied classloader holds all the classes from multiple Web applications in one big classloader and may cause unwanted interference.
Example
Imagine web modules "sales. war "and" stock. war ", both containing some version of" utility. jar ". in case "sales. war "uses version 1.0 and" stock. war "requires version 2.0, turning off the uniied Web Loader is the safest solution. if you don't, the first loaded library will have priority, and remains in the classloader till the reference count drops to zero.
The disadvantage of using isolated classloaders: either you need to duplicate the same library using SS multiple web modules, or add it to the classpath of your server instance (default: lib /). the instance libraries are ults, they can be overridden when the web module contains it's own custom versions.
The configuration file contains a small comment about isolation of JSP files as well, to separate two JSP files with the same name from two different web modules. in JBoss 4.0.5, using non-precompiled JSP pages, this seems to work fine, even with the JBoss uniied Web Loader.