JBoss ClassLoading Parent-Last loading

I wanted to understand loading parent-last on the application JBoss application server. We have an outdated application deployed in JBoss 4.2.1 GA. Why are we trying to load the parent last.

I mean the link. I wanted to know the parent last boot. This created a simple maven jar package application with maven-jar-plugin and configuration -> addDefaultImplementationEntries = true. I created 2 jar versions 1.0.0 and 1.0.1 from the same maven maf application. The bank has one TestClass class and a simple String return method that returns the version of the jar from which the class is loaded. that I wanted to experience using java2ClassLoadingCompliance . I have packaged version 1.0.0 jar on server / deployment / MyApplication / WEB-INF / lib (My web application is a simple servlet application that calls the class method, thus printing the version number with which it was called.) And the version 1.0.1 jar in / lib server.

Note . It is logically impractical to use an older version of jar in the application and redefine it with a newer version present in the lib server, but just want to experience class loading.

I tried the following

  • Without jboss-web.xml in the meta-inf folder.
  • I tried introducing jboss-we.xml into META-INF and did the same with java2ClassLoadingCompliance = false.
  • With java2ClassLoadingCompliance = true.

All the time, the class from the lib application will be loaded by the application.

My jboss-web.xml looks like a link

<jboss-web>
   <class-loading java2ClassLoadingCompliance="true">
      <loader-repository>
         com.example:archive=JBossClassLoadingTestServlet-0.0.1-SNAPSHOT.ear
         <loader-repository-config>java2ParentDelegation=true</loader-repository-config>
      </loader-repository>
   </class-loading>
</jboss-web>

Can someone help me understand the configuration of the parent last in JBoss? What error do I make here when a class is always loaded from a lib application?

+4
source share
1 answer

, . EAR, lib .

lib .

:

, , WAR, , JAR-.

, JBoss lib.

doc, AS7:

  • - , , API Java EE.
  • . , JBoss-deployment-structure.xml Dependencies: manifest.
  • - , , . WEB-INF/ WEB-INF/lib .
  • - . lib , EJB.

:

0

Source: https://habr.com/ru/post/1670110/


All Articles