Roberto
Roberto

Reputation: 1395

There is AnnotationException when try to deploy ear on websphere 8.5.5.13?

There is application on spring 4.13 So, when try to deploy ear-file on websphere 8.5.5.13 - there is error message

[12/18/18 14:56:41:946 MSK] 00000086 AnnotationCon E CWMDF0002E: Annotation processing failed with the following error: com.ibm.ws.metadata.annotations.AnnotationException: Annotation processing failed for class: META-INF/versions/9/javax/xml/bind/ModuleUtil.class

What kind of issue is it? This is may be installation error or error incompalebility of application and server libs?

application has intrance point

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"spring"})
public class WebAppInitalizer implements WebApplicationInitializer {
    private static final String CONFIG_LOCATION = "spring.config";
    private static final String MAPPING_URL = "/*";

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>> ONSTARTUP <<<<<<<<<<<<<<<<<<<<<<<<");
        WebApplicationContext context = getContext();
        servletContext.addListener(new ContextLoaderListener(context));
        ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping(MAPPING_URL);
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>> ONSTARTUP END <<<<<<<<<<<<<<<<<<<<<<<<");
    }

    private AnnotationConfigWebApplicationContext getContext() {
        AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        context.setConfigLocation(CONFIG_LOCATION);
        return context;
    }
}

and configs are

package spring.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan(basePackages = "spring")
public class AppConfig {
}


   package spring.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter {
}

and test controller is:

package spring.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @RequestMapping(value = "/greeting")
    public String healthCheck() {
        return "greeting";
    }

}

Upvotes: 6

Views: 10947

Answers (3)

Doug Breaux
Doug Breaux

Reputation: 5105

Also a (temporary) workaround is to use the archive or package filtering described in Reducing annotation searches during application deployment to exclude certain libraries or classes from scanning.

The product provides a configurable filtering function to reduce the number of classes that are searched for annotations. You can identify which modules or Java packages to ignore for annotations processing through four properties: (or manifest attributes):

Ignore-Scanning-Archives
Ignore-Scanning-Packages
Include-Scanning-Archives
Include-Scanning-Packages

The properties can be specified either in amm.filter.properties in app_server_root/properties, or can be specified as manifest attributes. You can also identify which modules or Java packages to ignore by using these system properties:

com.ibm.ws.amm.scan.context.filter.archives
com.ibm.ws.amm.scan.context.filter.packages
com.ibm.ws.amm.scan.context.include.archives
com.ibm.ws.amm.scan.context.include.packages

Use these options to limit which classes are scanned for annotations.

I used the amm.filter.properties version of this myself just recently, while awaiting applying an appropriate WebSphere fixpack, and it has allowed us to bypass our immediate issue.

In our case, it was Jackson 2.10 libraries complaining, so I copied the WebSphere root properties version of the above file to my profile/properties directory, and added the Jackson jars to the Ignore-Scanning-Archives section.

It also appears I had to restart our WebSphere ND Node Agent and redeploy the application ear/war in order to get past the original problem.

Upvotes: 2

jblye
jblye

Reputation: 373

The error message is complaining about a class under META-INF/versions/9 directory. That location indicates that you have a multi-release JAR with java V9 classes. WAS does not support Java V9 classes, but code has been added to tolerate them in multi-release JARs.

Multi-release JARs did not exist until after WAS 8.5.5 and WAS 9.0 were released. Five APARs were created for WAS 8.5.5 to address the problems that were discovered as multi-release JARs began to be added to applications. The list of APARs is below. Note that 3 APARs were included in 8.5.5.14 and the other 2 are in 8.5.5.15. You may not need all of them. It depends on your application, and in one case, the order in which the application classes are scanned.

There is a 6th APAR for WAS V9, which is only for performance. It is not applicable to WAS 8.5.5.

Bottom line: For full tolerance of multi-release JARs you need to move up to 8.5.5.15 or 9.0.0.10 or apply all of the APARs below.

  1. PI89708 – 8.5.5.14, 9.0.0.7
  2. PI93744 – 8.5.5.14, 9.0.0.8
  3. PI96826 – 8.5.5.14, 9.0.0.8
  4. PH02014 – 8.5.5.15, 9.0.0.10
  5. PH03710 – 8.5.5.15, 9.0.0.10
  6. PI98450 - N/A , 9.0.0.9

Upvotes: 9

covener
covener

Reputation: 17872

You need PI96826 in the very next fixpack

https://www-01.ibm.com/support/docview.wss?uid=swg1PI96826

Java V9 multi-release JARs contain Java V9 classes under the META-INF directory tree. The existence of Java V9 classes causes application start to fail with an exception similar to the following:

Upvotes: 4

Related Questions