A solution to a java. Lang. classcastexception: $ proxy65 Error

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.