Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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";
    }

}
like image 388
Roberto Avatar asked Dec 18 '18 13:12

Roberto


2 Answers

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
like image 53
jblye Avatar answered Nov 18 '22 20:11

jblye


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:

like image 4
covener Avatar answered Nov 18 '22 20:11

covener