Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Problems encountered in migrating projects from JBOSS 6 to JBOSS 7

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following is only recorded in the form of notes to prevent further trouble, and to provide a reference:

1. The data source in the project uses the JNDI of JBOSS. In versions 6 and 7, the configuration is quite different. There are many specific configuration methods and data configuration, so I will not repeat them here (please refer to http://www.tuicool.com/articles/aqI7V3). After upgrading to JBOSS 7, ARRAY is needed because the Oracle table is used in the project, and OracleConnection is needed to create this object, which is converted in JBOSS6

If (conn.isWrapperFor (OracleConnection.class)) {oraConn= conn.unwrap (OracleConnection.class);}

But when you upgrade to 7, you will find that this code does not work. I thought you would like to do it in a different way, such as:

If (conn instanceof WrappedConnection) {oraConn= (OracleConnection) ((WrappedConnectionJDK6) conn) .getUnderlyingConnection ();

(or through conn.getMetaData (). GetConnection () to obtain T4CConnection to transform into OracleConnection)

Because the Connection instance obtained using JBOSS's JNDI is actually a WrappedConnectionJDK6 object, you need to add the ironjacamar-jdbc-1.0.9.Final.jar that comes with jboss to the classpath, but in the end, you will find that this code does not work, and conn instanceof org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 will not be established. A transformation error will be reported if the conversion is forced:

Java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6cannot be cast to org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6

Oh, I can't turn myself. It's a strange thing. According to the analysis of the data found, the guess is related to the loading of the JBOSS 7 module: if module a loads the class Test.class (or jar), module b also loads Test.class (or jar) once (here the Test.class of the two modules is actually the same class file), but if you get an instance of Test.class in module an in the b module and you force the transformation into the Test.class of module b in the code, then a transformation error will be reported.

The solution is to tell jboss the Test.class (jar) to be used by module b and directly use the Test.class (jar) of module a.

The specific configuration method is to add the following configuration to the WEB-INF/jboss-deployment-structure.xml configuration file:

The annotated org.jboss.ironjacamar.jdbcadapters is the configuration if you want to transform to org.jboss.jca.adapters.jdbc.WrappedConnectionJDK6, and com.oracledatabase.oracle is the name in my local JNDIoracle module.xml:

After this configuration, the classes used in the code will be loaded as classes in the dependent module. After this configuration, conn.isWrapperFor (OracleConnection.class) becomes available again.

2. Jboss-web.xml in jboss 7 is no longer configured with class-loading, otherwise an error that cannot be parsed will be reported. Reference:

Http://www.cnblogs.com/davidwang456/p/3959561.html

3. In jboss 7, the local tag tld file used by jsp must be placed in WEB-INF, and the META-INF directory under the class directory will report a FileNotFound error.

The above content is for reference only. I am also new to JBOSS.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report