Spring Boot - ApplicationContext Null - java

I have combined the following two projects:
https://github.com/jpenninkhof/odata-boilerplate
and
https://github.com/isopropylcyanide/Jwt-Spring-Security-JPA
I have them working separatedly but when I combine them in the same project the call to http://localhost:9004/odata.svc doesn't work. The attribute attribute applicationContext is null. Actually in the tab Expresions is null but on the tooltip has still the right value
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.accolite.pru.health</groupId>
<artifactId>AuthApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>AuthApp</name>
<description>Demo project for Spring Boot</description>
<url>https://github.com/isopropylcyanide/Jwt-Spring-Security-JPA</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<developers>
<developer>
<name>Aman Garg</name>
<email>amangargcse#outlook.com</email>
<timezone>5</timezone>
<id>isopropylcyanide</id>
</developer>
</developers>
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<developerConnection>scm:git:git#github.com:isopropylcyanide/Jwt-Spring-Security-JPA.git
</developerConnection>
<connection>scm:git#github.com:isopropylcyanide/Jwt-Spring-Security-JPA.git</connection>
<url>https://github.com/isopropylcyanide/Jwt-Spring-Security-JPA/tree/master</url>
<tag>HEAD</tag>
</scm>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/isopropylcyanide/Jwt-Spring-Security-JPA/issues</url>
</issueManagement>
<properties>
<!--Build -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<!--Build -->
<jjwt.version>0.9.1</jjwt.version>
<log4j.version>1.2.17</log4j.version>
<spring.boot.version>2.3.0.RELEASE</spring.boot.version>
<freemarker.version>2.3.28</freemarker.version>
<swagger.version>2.9.2</swagger.version>
<expiring.map.version>0.5.9</expiring.map.version>
<!--Sonar / Code Coverage -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPaths>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPaths>
<surefire.version>2.19.1</surefire.version>
<sonar.language>java</sonar.language>
<jacoco.version>0.8.2</jacoco.version>
<sonar.exclusions>**/*Configuration.java,**/*Exception.java,**/conf/**/*,**/model/**/*</sonar.exclusions>
<java.version>1.8</java.version>
<cxf.version>3.3.6</cxf.version>
<olingo.version>2.0.11</olingo.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.14.FINAL</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-odata2-jpa-processor-api</artifactId>
<version>${olingo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-odata2-jpa-processor-core</artifactId>
<version>${olingo.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<!--Log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!--Jwt -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>
<!-- For Java 8 Date/Time Support -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!--Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<!--Swagger 2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<!--Expiring Map -->
<dependency>
<groupId>net.jodah</groupId>
<artifactId>expiringmap</artifactId>
<version>${expiring.map.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-odata2-jpa-processor-api</artifactId>
<version>${olingo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-odata2-jpa-processor-core</artifactId>
<version>${olingo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-odata2-api</artifactId>
<version>${olingo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-odata2-core</artifactId>
<version>${olingo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-odata2-api-annotation</artifactId>
<version>${olingo.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--Jacoco Code Coverage Plugin -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<!-- pre-unit-test execution helps setting up some maven property, which
will be used later by JaCoCo -->
<execution>
<id>coverage-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<append>true</append>
<destFile>${project.basedir}/target/jacoco.exec</destFile>
<!-- passing property which will contains settings for JaCoCo agent.
If not specified, then "argLine" would be used for "jar" packaging -->
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>download-sources</id>
<goals>
<goal>sources</goal>
</goals>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
AuthAppApplication.java
package com.accolite.pru.health.AuthApp;
#SpringBootApplication
#EntityScan(basePackageClasses = {
AuthAppApplication.class,
Jsr310JpaConverters.class
})
public class AuthAppApplication {
public static void main(String[] args) {
SpringApplication.run(AuthAppApplication.class, args);
}
}
StringContextUtil.java
package com.accolite.pru.health.AuthApp.utils;
#Component
public class SpringContextsUtil implements ApplicationContextAware {
final Logger logger = LoggerFactory.getLogger(SpringContextsUtil.class);
private static ApplicationContext applicationContext;
public SpringContextsUtil() {
logger.debug("Loading SpringContextsUtil");
}
#Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
logger.debug("Inject ApplicationContext: {} into SpringContextsUtil", applicationContext);
SpringContextsUtil.applicationContext = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
public static Object getBean(String name) throws BeansException {
return applicationContext.getBean(name);
}
#SuppressWarnings({ "unchecked", "rawtypes" })
public static Object getBean(String name, Class requiredType) throws BeansException {
return applicationContext.getBean(name, requiredType);
}
public static boolean containsBean(String name) {
return applicationContext.containsBean(name);
}
public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
return applicationContext.isSingleton(name);
}
#SuppressWarnings("rawtypes")
public static Class getType(String name) throws NoSuchBeanDefinitionException {
return applicationContext.getType(name);
}
public static String[] getAliases(String name) throws NoSuchBeanDefinitionException {
return applicationContext.getAliases(name);
}
}
CxfServletRegister.java
#Configuration
public class CxfServletRegister {
#Bean
public ServletRegistrationBean<CXFNonSpringJaxrsServlet> getODataServletRegistrationBean() {
ServletRegistrationBean<CXFNonSpringJaxrsServlet> odataServletRegistrationBean = new ServletRegistrationBean<CXFNonSpringJaxrsServlet>(new CXFNonSpringJaxrsServlet(), "/odata.svc/*");
Map<String, String> initParameters = new HashMap<String, String>();
initParameters.put("javax.ws.rs.Application", "org.apache.olingo.odata2.core.rest.app.ODataApplication");
initParameters.put("org.apache.olingo.odata2.service.factory", "com.accolite.pru.health.AuthApp.utils.JPAServiceFactory");
odataServletRegistrationBean.setInitParameters(initParameters);
return odataServletRegistrationBean;
}
}
The rest of the code is as in the original projects,

It seems the following dependency was interfering. I removed it and now it works
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>

Related

Serialize LocalDate as TimeStamp using Spring Boot 2.3.4.RELEASE Jackson2ObjectMapper

I tried several ways to change the default jackson configuration within the spring boot and it doesn't work.
it simply ignores all configuration
#SpringBootApplication
public class AvaliacaoairtonApplication {
public static final String URL = "*";
public static void main(String[] args) {
SpringApplication.run(AvaliacaoairtonApplication.class, args);
}
#Bean
#Primary
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
ObjectMapper objectMapper = builder.build();
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
JavaTimeModule javaTimeModule = new JavaTimeModule();
javaTimeModule.addSerializer(LocalDate.class, new StdScalarSerializer<LocalDate>(LocalDate.class) {
#Override
public void serialize(LocalDate localDate, JsonGenerator jsonGenerator,
SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeString(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
}
});
objectMapper.registerModule(javaTimeModule);
return objectMapper;
}
}
application.properties
spring.jackson.serialization.write-dates-as-timestamps=false
POM
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>br.com.softplan</groupId>
<artifactId>avaliacaoairton</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>avaliacaoairton</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>6.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
result
enter image description here

Parse date with groovy using spring boot

I create a project with spring boot and groovy,
I wanna parse a date but I dont understand why i got error.
For example i created a basic class for parse a Date
This is my class
class Test {
public static void main(String ...args){
String oldDate = '04-DEC-2012'
Date date = Date.parse( 'dd-MMM-yyyy', oldDate )
String newDate = date.format( 'M-d-yyyy' )
}
}
I got the error,
Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: static java.util.Date.parse() is applicable for argument types: (String, String) values: [dd-MMM-yyyy, 04-DEC-2012]
Possible solutions: parse(java.lang.String), wait(), clone(), any(), grep(), use([Ljava.lang.Object;)
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1525)
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1511)
at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:50)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:135)
My pom file is
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
</parent>
<groupId>com.xxx</groupId>
<artifactId>xxxxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>xxxxx</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json-->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-json</artifactId>
<version>3.0.0-rc-2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/http-builder -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>http-builder</artifactId>
<version>0.4.0</version>
</dependency>
<!--cliente rest -->
<dependency>
    <groupId>com.mashape.unirest</groupId>
    <artifactId>unirest-java</artifactId>
    <version>1.4.9</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.8.1</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>compileTests</goal>
<goal>removeStubs</goal>
<goal>removeTestStubs</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Its possible that I need some extra configuration ?
I read some post I only need Date.parse("format","date")
but for some reason I dont understand what i am doing wrong
Add the groovy date-util package
https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-dateutil
I change the version of groovy from 2.5.8 to 3.0.0-alpha-1 and the problem was resolved
So that I modified my pom.xml file
I delete this dependency
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
I add this line
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>3.0.0-alpha-1</version>
</dependency>
I never had add the depency date-util .
Thanks to everyone for your support

Spring Boot JAR Not Working on Windows Server

I have one web app which is working fine on the local machine, but when I am trying to deploy the same JAR to one of my windows server, it's not working fine.
it's running as a service but when I'm trying to access the web app through the Browser it doesn't render anything, is their any additional configuration is required in order to deploy it and up it over windows server, any help will be highly appreciable, the stack that I'm using the Web App is mentioned below.
Spring Boot - 1.4.7.RELEASE
Java - Version - 1.8
MySQL - 5.7
Embedded Tomcat Version- 8.5.15
#SpringBootApplication
#ComponentScan(basePackages = "com.abc.xyz")
public class Application extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
application.properties file is as follows
#JPA
#spring.datasource.hikari.username = root
#spring.datasource.hikari.password = root
#spring.datasource.hikari.jdbc-url = jdbc:mysql://localhost:3306/dbname?useUnicode=yes&characterEncoding=UTF-8
#spring.datasource.type = com.zaxxer.hikari.HikariDataSource
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.username = root
spring.datasource.password = xyz
spring.datasource.url = jdbc:mysql://localhost:3306/dbname?useUnicode=yes&characterEncoding=UTF-8&useSSL=false
spring.jpa.hibernate.ddl-auto = update
spring.jpa.show-sql = false
#spring.jpa.format-sql = true
spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect
spring.jpa.properties.hibernate.current_session_context_class = org.springframework.orm.hibernate5.SpringSessionContext
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
#Logging
logging.level.org.springframework = INFO
logging.level.org.hibernate = INFO
logging.level.com.karza = INFO
logging.file= D:/abc/xyz.log
# MVC
#spring.view.prefix=/templates/views/
#spring.view.suffix=.jsp
spring.mvc.view.prefix=/WEB-INF/jsp/views/
spring.mvc.view.suffix=.jsp
#spring.view.prefix=/WEB-INF/jsp/views/
#spring.view.suffix=.jsp
#server
server.context-path = /
server.port = 8090
server.compression.enabled = true
server.compression.mime-types = application/json,application/xml,text/html,text/xml,text/plain
pom.xml is as follows
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.xyz</groupId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ABC</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.7.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency> -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> </dependency> <dependency> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> -->
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId>
</dependency> -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<!-- <version>1.4.196</version> -->
</dependency>
<dependency>
<groupId>net.sf.flexjson</groupId>
<artifactId>flexjson</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-web</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-logging-logback</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt</artifactId>
<version>0.9.7</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt-compute</artifactId>
<version>0.9.7</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt-network</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt-sql</artifactId>
<version>0.9.7</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt-storage</artifactId>
<version>0.9.7</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt-websites</artifactId>
<version>0.9.7</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
<!-- <plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.7.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> -->
</build>
<artifactId>ABC</artifactId>
</project>
I just updated the pom.XML, I updated it from JAR to war and run it as WAR and it worked, I executed it JAVA -jar APPLICATION_NAME.jar, and it worked like charm.
Hope this will help others as well.
Citing the link which saved me.
https://www.mkyong.com/spring-boot/spring-boot-hello-world-example-jsp/

org.apache.xml.security not working under Spring Boot

I am trying to work with org.apache.santuario
If I invoke it in Spring Boot main method, it fails with:
10:31:40.245 [main] ERROR org.apache.xml.security.Init - Bad:
java.lang.IllegalArgumentException: InputStream cannot be null
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:117)
at org.apache.xml.security.Init.init(Unknown Source)
at ru.gosuslugi.dom.signature.demo.commands.SignCommand.<init>(SignCommand.java:55)
at com.ric.web.Gisxn2Application.main(Gisxn2Application.java:18)
java.lang.IllegalArgumentException: InputStream cannot be null
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:117)
My main method:
package com.ric.web;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import ru.gosuslugi.dom.signature.demo.commands.Command;
import ru.gosuslugi.dom.signature.demo.commands.SignCommand;
#SpringBootApplication
public class Gisxn2Application {
public static Command sc;
public static void main(String[] args) {
//Создать объект подписывания XML
try {
sc = new SignCommand();
System.out.println("Объект подписывания XML СОЗДАН!");
} catch (Exception e1) {
System.out.println("Объект подписывания XML не создан!");
e1.printStackTrace();
}
SpringApplication.run(Gisxn2Application.class, args);
}
}
But if I call it from non #SpringBootApplication - class main module, it works perfectly.
I use next Jvm param for work with this program:
-Dorg.apache.xml.security.resource.config=resource/tj-msxml.xml
Could somebody describe what is this issue, why does it happen?
Upd1: SignCommand:
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import xades4j.algorithms.EnvelopedSignatureTransform;
import xades4j.algorithms.ExclusiveCanonicalXMLWithoutComments;
import xades4j.production.*;
import xades4j.properties.DataObjectDesc;
import xades4j.providers.KeyingDataProvider;
import xades4j.providers.MessageDigestEngineProvider;
import xades4j.providers.impl.DirectKeyingDataProvider;
import java.security.KeyException;
import java.security.KeyStore;
import java.security.Provider;
import java.security.Security;
import java.security.cert.X509Certificate;
public class SignCommand implements Command {
private SignParameters parameters;
private XadesSigner signer;
//конструктор
public SignCommand(SignParameters parameters) {
System.out.println("############ SIGNCOMMAND CONSTRUCTOR START!");
org.apache.xml.security.Init.init();
this.parameters = parameters;
}
//конструктор
public SignCommand() throws Exception {
// init Apache Santuario
org.apache.xml.security.Init.init(); <--- here error
Upd2:
My pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ric.soap</groupId>
<artifactId>Soap2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<repositories>
<repository>
<id>cata1</id>
<name>cata</name>
<url>http://repo.boundlessgeo.com/main/</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Spring -->
<spring-framework.version>4.2.5.RELEASE</spring-framework.version>
<!-- Hibernate / JPA -->
<hibernate.version>5.1.0.Final</hibernate.version>
<!-- Test -->
<junit.version>4.12</junit.version>
<start-class>com.ric.web.SoapWebApplication</start-class>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath />
</parent>
<dependencies>
<!-- BWC -->
<dependency>
<groupId>com.ric.bill</groupId>
<artifactId>BWC</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- <dependency>
<groupId>checkSoap</groupId>
<artifactId>chksp</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-loader</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<!-- Не удалять! Используется для AuthConfigFactory!!! -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>9.0.0.M6</version>
</dependency>
<!-- <dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>8.5.2</version>
</dependency> -->
<!-- https://mvnrepository.com/artifact/javax.security.auth.message/javax.security.auth.message-api -->
<dependency>
<groupId>javax.security.auth.message</groupId>
<artifactId>javax.security.auth.message-api</artifactId>
<version>1.1</version>
</dependency>
<!-- Test Artifacts -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache2</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-terracotta</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>oracle</artifactId>
<version>10.2.0.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.diffplug.durian/durian -->
<dependency>
<groupId>com.diffplug.durian</groupId>
<artifactId>durian</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.48</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.55</version>
</dependency>
<dependency>
<groupId>org.signserver.xades4j</groupId>
<artifactId>xades4j</artifactId>
<version>1.3.2-signserver4</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-loader</artifactId>
</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I found out that next Jvm param:
-Dorg.apache.xml.security.resource.config=resource/tj-msxml.xml
changes inside main procedure, every time, when I run program.
To find it I wrote next line in main procedure:
System.out.println("PROP1="+System.getProperty("org.apache.xml.security.resource.config"));
The output was "PROP1=resource/tj-msxml.xml-noverify"
It is very weird, because, I expect "PROP1=resource/tj-msxml.xml"
I've corrected this Issue using this:
System.setProperty("org.apache.xml.security.resource.config", "resource/tj-msxml.xml");
But I don't satisfied with my solution, may be somebody correct me?

Facing NoSuchMethodError for io.netty.util.AttributeKey.valueOf() method with grpc and protobuf Hello world example

After running GreetingServerTest.java tests I am getting below given errors. I am using grpc 1.1.0-SNAPSHOT libraries and trying to implement basic Helloword example of grpc given in there git repo. Can anybody please suggest which libraries I am missing or there's anything else I need to do.
java.lang.NoSuchMethodError: io.netty.util.AttributeKey.valueOf(Ljava/lang/Class;Ljava/lang/String;)Lio/netty/util/AttributeKey;
at io.grpc.netty.Utils.<clinit>(Utils.java:87)
at io.grpc.netty.NettyServer.allocateSharedGroups(NettyServer.java:187)
at io.grpc.netty.NettyServer.start(NettyServer.java:116)
at io.grpc.internal.ServerImpl.start(ServerImpl.java:156)
at io.grpc.internal.ServerImpl.start(ServerImpl.java:83)
at com.xyz.communication.datacollection.GrpcServerTest.test(GrpcServerTest.java:23)
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
<artifactId>InternodeCommunication</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Spring -->
<spring-framework.version>4.3.1.RELEASE</spring-framework.version>
<!-- Logging -->
<logback.version>1.0.13</logback.version>
<slf4j.version>1.7.5</slf4j.version>
<!-- Kundera JPA -->
<kundera-version>3.4</kundera-version>
<!-- Hibernate jpa -->
<hibernate.version>4.2.1.Final</hibernate.version>
<!-- Test -->
<junit.version>4.12</junit.version>
<grpc.version>1.1.0-SNAPSHOT</grpc.version>
<!-- Generic properties -->
</properties>
<dependencies>
<!-- Spring and Transactions -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- kafka -->
<!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka_2.10 -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.10</artifactId>
<version>0.10.0.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.xyz</groupId>
<artifactId>Common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.5.Final</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>${grpc.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.grpc/grpc-all -->
<!-- https://mvnrepository.com/artifact/io.netty/netty-codec -->
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
<!-- Test Artifacts -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring-framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>com.xyz</groupId>
<artifactId>Common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.4.1.Final</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<!-- The version of protoc must match protobuf-java. If you don't depend
on protobuf-java directly, you will be transitively depending on the protobuf-java
version that grpc depends on. -->
<protocArtifact>com.google.protobuf:protoc:3.0.0:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.1.0-SNAPSHOT:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
hello_world.proto file
syntax = "proto3";
option java_multiple_files = true;
package com.xyz.communication.example;
message HelloRequest {
string name = 1;
}
message HelloResponse {
string greeting = 1;
}
service GreetingService {
rpc greeting(HelloRequest) returns (HelloResponse);
}
GreetingServerTest.java
#ContextConfiguration("/communication-test-beans.xml")
#RunWith(SpringJUnit4ClassRunner.class)
public class GrpcServerTest {
#Test
public void test() throws IOException, InterruptedException {
io.grpc.Server server = ServerBuilder.forPort(8080).addService(new GrpcServerImpl().bindService()).build();
server.start();
server.awaitTermination();
}
}
class GrpcServerImpl extends GreetingServiceGrpc.GreetingServiceImplBase {
#Override
public void greeting(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {
HelloResponse response = HelloResponse.newBuilder().setGreeting("Hello " + request.getName()).build();
responseObserver.onNext(response);
responseObserver.onCompleted();
}
#Override
public ServerServiceDefinition bindService() {
return super.bindService();
}
}
There could be multiple versions of netty jar in you class path during runtime. Use following command to check dependency tree.
mvn dependency:tree -Dverbose
Or your container provides the netty jar might be clashing with the version of jar you packaging with your application.
Here is what worked for me. I needed to shade io.netty and com.google.
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>myshade.io.netty</shadedPattern>
</relocation>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>myshade.com.google</shadedPattern>
</relocation>

Categories