Help! Exception while running as Jar
doonewei opened this issue · 5 comments
doonewei commented
Exception sending context initialized event to listener instance of class org.brutusin.rpc.RpcInitListener
java.lang.NullPointerException
at org.brutusin.rpc.RpcInitListener.initWebsocketRpcRuntime(RpcInitListener.java:75)
at org.brutusin.rpc.RpcInitListener.contextInitialized(RpcInitListener.java:44)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4738)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5181)
idelvall commented
Please, attach your pom file
doonewei commented
`<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.navinfo.had</groupId>`
`<artifactId>rpc</artifactId>`
`<version>0.0.1</version>`
` <packaging>jar</packaging>`
`<name>convesion-service</name>`
` <url>http://maven.apache.org</url>`
` <properties>`
` <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>`
` </properties>`
` <dependencies>`
` <dependency>`
` <groupId>junit</groupId>`
` <artifactId>junit</artifactId>`
` <version>3.8.1</version>`
` <scope>test</scope>`
` </dependency>`
` <dependency>`
`<groupId>org.brutusin</groupId>`
`<artifactId>rpc</artifactId>`
`<version>1.1.0</version>`
`</dependency>`
` <dependency>`
`<groupId>com.navinfo.had</groupId>`
`<artifactId>mif-engine</artifactId>`
`<version>0.0.1</version>`
`</dependency>`
` </dependencies>`
` <build>`
` <plugins>`
` <plugin>`
`<groupId>org.apache.maven.plugins</groupId>`
`<artifactId>maven-shade-plugin</artifactId>`
` <version>1.2.1</version>`
`<executions>`
`<execution>`
` <phase>package</phase>`
`<goals>`
` <goal>shade</goal>`
`</goals>`
`<configuration>`
` <transformers>`
`<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">`
` <mainClass>org.brutusin.rpc.Main</mainClass>`
`</transformer>`
` </transformers>`
`</configuration>`
` </execution>`
`</executions>`
`</plugin>`
`</plugins>`
`</build>`
`</project>`
idelvall commented
Hi, there were several issues with your project:
- Your were using a decontinued artifact id (
org.brutusin:rpc
) - When shading, you need to transform service provider manifests in order to not lose information (there is a name collision)
Try this out:
<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.navinfo.had</groupId>
<artifactId>rpc</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>convesion-service</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<brutusin-rpc.version>1.2.6</brutusin-rpc.version>
<json-provider-version>2.4.0</json-provider-version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.brutusin</groupId>
<artifactId>rpc-api</artifactId>
<version>${brutusin-rpc.version}</version>
</dependency>
<dependency>
<groupId>org.brutusin</groupId>
<artifactId>rpc-tomcat</artifactId>
<version>${brutusin-rpc.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.brutusin</groupId>
<artifactId>rpc-impl</artifactId>
<version>${brutusin-rpc.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.brutusin</groupId>
<artifactId>rpc-repo</artifactId>
<version>${brutusin-rpc.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.brutusin</groupId>
<artifactId>json-provider</artifactId>
<version>${json-provider-version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.brutusin.rpc.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
idelvall commented
One request: if you like the project, please star it and share it.
Thanks!
idelvall commented
Note: Updated pom to add dependency to org.brutusin:rpc-api