JNA class not Found Error using FANNJ for Ubuntu in Eclipse - neural-network

I'm trying to use FANNJ in Eclipse (on Ubuntu), trying to create a toy program but it keeps giving this error as shown below.
Code:
package myPackage;
import com.googlecode.fannj.Fann;
public class mainclass {
public static void man(String[] args) {
System.out.println("1");
Fann fann = new Fann("/home/sahil/Desktop/Intern/Java/eclipse/Workspace/UsingFANN/ANN_Net_Output1.net");
}
}
Error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Platform
at com.googlecode.fannj.Fann.<clinit>(Fann.java:51)
at myPackage.mainclass.main(mainclass.java:9)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Platform
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Could someone who works with FANNJ on Ubuntu please explain why this error comes up?

Make sure you set the jna.library.path system property to the path to the FANN Library. This property is similar to java.library.path but only applies to libraries loaded by JNA.
You should also change the appropriate library access environment variable before launching the VM. (LD_LIBRARY_PATH on Linux)
From the command line:
LD_LIBRARY_PATH=/usr/local/lib
java -Djna.library.path=/usr/local/lib -cp fannj-0.6.jar:jna-3.2.2.jar YourClass

You have to download the missing library "jna". After get it you must point it in eclipse (Using the properties of your project > Java Build Path > Libraries, and adding the jar (you can browse it on "Add External JARs...").
A good way to get all dependancies for a project is by "maven". You can simply create a "pom.xml" file on root folder of your project. So write it down:
<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.something</groupId>
<artifactId>MyProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>MyProject</name>
<description>MyProject</description>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.fannj/fannj -->
<dependency>
<groupId>com.googlecode.fannj</groupId>
<artifactId>fannj</artifactId>
<version>0.6</version>
</dependency>
</dependencies>
</project>
And finally, on commmand line type # mvn install, it will download the dependancies and by default put all libraries in your "homefolder/.m2". So, browse for JNA library, you gonna find it in some folder like this: "~/.m2/repository/net/java/dev/jna/jna/3.2.7". If your project uses other libraries besides fannj, you can add it in pom file to get everything together.

Related

Maven jar dependency not found at runtime by OSGi environment

I'm building an Eclipse product that requires some external dependencies, which are not bundled as Eclipse plugins.
For example javax.json-1.1.4.jar.
I'm usign a target platform file, with Maven dependency added. This is the relevant part of the .target file:
<location includeDependencyScope="compile" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
......
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
<type>jar</type>
</dependency>
</dependencies>
</location>
The resulting bundle is included from the plugin that uses this Json implementation: this is the MANIFEST of the plugin
Require-Bundle: org.glassfish.javax.json;bundle-version="1.1.4"
The plugin compiles and run normally. The problem happens at runtime, when the Json implementation is loaded:
2022-03-11 09:44:18,166 ERROR [main]: Provider org.glassfish.json.JsonProviderImpl not found
2022-03-11 09:44:18,168 ERROR [main]:
javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
at javax.json.spi.JsonProvider.provider(JsonProvider.java:99)
at javax.json.Json.createReader(Json.java:225)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.MotorDataHandler.parseMotorJsonFile(MotorDataHandler.java:64)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.DBHandler.initMotorsDB(DBHandler.java:209)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.DBHandler.getMotors(DBHandler.java:116)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.FieldBusDevice.getMotors(FieldBusDevice.java:1323)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.FieldBusDevice.createFromSiriusString(FieldBusDevice.java:1257)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.HwConfiguratorFactoryImpl.createFieldBusDeviceFromString(HwConfiguratorFactoryImpl.java:252)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.HwConfiguratorFactoryImpl.createFromString(HwConfiguratorFactoryImpl.java:93)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.createFromString(XMLHelperImpl.java:1615)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHelperImpl.java:1156)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2710)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:2769)
at org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:79)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:2247)
Caused by: java.lang.ClassNotFoundException: org.glassfish.json.JsonProviderImpl cannot be found by javax.json-api_1.1.4
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:516)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:511)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:403)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at javax.json.spi.JsonProvider.provider(JsonProvider.java:96)
at javax.json.Json.createReader(Json.java:225)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.MotorDataHandler.parseMotorJsonFile(MotorDataHandler.java:64)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.DBHandler.initMotorsDB(DBHandler.java:209)
at com.test.mas.rcp.hwconfigurator.sirius.core.utils.DBHandler.getMotors(DBHandler.java:116)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.FieldBusDevice.getMotors(FieldBusDevice.java:1323)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.FieldBusDevice.createFromSiriusString(FieldBusDevice.java:1257)
at com.test.mas.rcp.hwconfigurator.sirius.core.impl.HwConfiguratorFactoryImpl.createFieldBusDeviceFromString(HwConfiguratorFactoryImpl.java:252)
The javax.json-1.1.4.jar is not found at runtime by the api jar javax.json-api_1.1.4.
The only way I found to make it work is to add the implementation jar to the runtime classpath settings of the plugin, in the Bundle-Classpath:
Bundle-ClassPath: .,
lib/javax.json-1.1.4.jar,
This requires the jar in the lib folder of the plugin, while it is already included from the tartget platform. It should be enough..
Is there a configuration or something to be done to make the OSGi environment recognise the jar as a Maven dependency at runtime?
I have read about Eclipse-BuddyPolicy and DynamicImport-Package but I don't know how to used them in my case, and if they are usefull.
This https://github.com/eclipse-ee4j/jsonp/issues/96 says that it "Should be fixed with javax.json:1.1.4 and jakarta.json:1.1.5" but I don't
get how...
I managed to fix this problem, thanks to the comments in this thread:
https://github.com/eclipse-ee4j/jax-ws-api/issues/90
in particular the last one:
https://github.com/eclipse-ee4j/jax-ws-api/issues/90#issuecomment-952793454
This is related to a veri similar problem I had with the implementation of the
com.sun.xml.ws.spi.ProviderImpl web service provider.
Including the OSGi Resource Locator in the bundle manifest, and the plugin with the actual implementations, make them discoverable at runtime.
This is the dependency in the target platform file:
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>osgi-resource-locator</artifactId>
<version>2.5.0-b42</version>
<type>jar</type>
</dependency>
In the end, for the Json problem, I switched to the Eclipse Parsson implementation which works at runtime without problems.
These are the needed dependencies in the target platform:
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>jakarta.json</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>

Errors when deploying kjar to jBPM/KieServer

I've been evaluating jBPM workbench and KieServer for automatically building and deploying rules, and I'm stuck on what I'm doing wrong. My goal is to have jars built and deployed to KieServer with minimal human intervention, and I've done the following:
Started a Docker container from https://hub.docker.com/r/jboss/jbpm-server-full. I'm able to create and deploy projects from within Workbench - but our workflow will also contain rules built outside of Workbench. If everything looks useful I'll just deploy the Kie Server, but I'm just in the evaluation stage.
Created a simple rules project, with a single Data object and rule (copied directly from a successful deployment using Workbench with modified package name to prevent possible conflict) and with my settings.xml with the correct credentials and the following 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.example</groupId>
<artifactId>rules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>kjar</packaging>
<properties>
<kie.version>7.50.0.Final</kie.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<distributionManagement>
<repository>
<id>guvnor-m2-repo</id>
<name>JBPM Workbench Repo</name>
<url>http://localhost:8080/business-central/maven2/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-model-compiler</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${kie.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>${kie.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Built the project using mvn clean package deploy -
The project gets built without error and apparently accepted by the service successfully. I can see the jar in the Docker instance, under /opt/jboss/wildfly/bin/repositories/kie/global/com/example/rules/1.0.0-SNAPSHOT
Tried to create the container using the http://localhost:8080/kie-server/services/rest/server/containers/test PUT API (with correct credentials) but got the following error
{
"type": "FAILURE",
"msg": "Failed to create container test with module com.example:rules:1.0.0-SNAPSHOT: java.lang.RuntimeException: Cannot find KieModule: com.example:rules:1.0.0-SNAPSHOT",
"result": null
}
Tried to create a deployment unit in Workbench. I can see the package in the list and can select it, but the first time I do, I get the following error (it's barely visible in a single line text box - I've formatted it for clarity. This is a selection of a few lines out about 600)
{"ToSubject":"org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService:RPC","CommandType":"getProcessConfig:java.lang.String:","Qualifiers":{"^EncodedType":"java.util.ArrayList","^ObjectID":"1","^Value":[]},"ReplyTo":"org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService:RPC.getProcessConfig:java.lang.String::41:RespondTo:RPC","ErrorTo":"org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService:RPC.getProcessConfig:java.lang.String::41:Errors:RPC","AdditionalDetails":"<tt>
org.jboss.errai.bus.client.api.base.MessageDeliveryFailure: error invoking RPC endpoint public abstract org.kie.workbench.common.screens.server.management.model.ProcessConfigModule org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService.getProcessConfig(java.lang.String) throws java.io.IOException
at deployment.business-central.war/org.jboss.errai.bus.server.io.AbstractRPCMethodCallback.invokeMethodFromMessage(AbstractRPCMethodCallback.java:75)
at deployment.business-central.war/org.jboss.errai.bus.server.io.ValueReplyRPCEndpointCallback.callback(ValueReplyRPCEndpointCallback.java:40)
at deployment.business-central.war/org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54)
at deployment.business-central.war/org.jboss.errai.cdi.server.CDIExtensionPoints$2.callback(CDIExtensionPoints.java:448)
at deployment.business-central.war/org.jboss.errai.bus.server.DeliveryPlan.deliver(DeliveryPlan.java:47)
at deployment.business-central.war/org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:297)
...
Caused by: java.lang.NullPointerException: <No Message>
at deployment.business-central.war/org.apache.commons.io.IOUtils.toInputStream(IOUtils.java:1647)
at deployment.business-central.war/org.kie.workbench.common.screens.server.management.backend.service.DeploymentDescriptorServiceCDI.getProcessConfig(DeploymentDescriptorServiceCDI.java:56)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.weld.core#3.1.3.Final/org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:38)
at org.jboss.weld.core#3.1.3.Final/org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:106)
at deployment.business-central.war/org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService$1790586371$Proxy$_$$_WeldClientProxy.getProcessConfig(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
On selecting and trying to finish the deployment subsequently, I no longer get the above error but this time get the message GAV 'com.example:rules:1.0.0-SNAPSHOT' not found in the Maven repository. Are you sure you want to deploy it? with the following stack trace in the logs
17:54:30,873 WARN [org.appformer.maven.integration.MavenRepository] (default task-16) Unable to resolve artifact: com.example:rules:pom:1.0.0-SNAPSHOT
17:54:31,177 WARN [org.appformer.maven.integration.MavenRepository] (default task-16) Unable to resolve artifact: com.example:rules:1.0.0-SNAPSHOT
17:54:31,358 WARN [org.appformer.maven.integration.MavenRepository] (default task-16) Unable to resolve artifact: com.example:rules:pom:1.0.0-SNAPSHOT
17:54:31,360 ERROR [org.kie.server.services.impl.KieServerImpl] (default task-16) Error creating container 'baz' for module 'com.example:rules:1.0.0-SNAPSHOT': java.lang.RuntimeException: Cannot find KieModule: com.example:rules:1.0.0-SNAPSHOT
at deployment.kie-server.war//org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:190)
at deployment.kie-server.war//org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:180)
at deployment.kie-server.war//org.kie.server.services.impl.KieServerImpl.createInternalKieContainer(KieServerImpl.java:373)
at deployment.kie-server.war//org.kie.server.services.impl.KieServerImpl.createContainer(KieServerImpl.java:286)
at deployment.kie-server.war//org.kie.server.remote.rest.common.resource.KieServerRestImpl.createContainer(KieServerRestImpl.java:155)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
So it looks like I've followed all the steps (that I know about) correctly - the jar is built, it's deployed to the /opt/jboss/wildfly/bin/repositories/kie/global/ directory, it's visible in Workbench. But it's not deployable as a container in KieServer. Does anyone have any hints on what I've done wrong?
I found an error in my project. I accidentally copied maven/pom.properties from another project into my META-INF directory, that had a different groupId and artifactId from the jar I was building. This caused the server to deploy the jar into the wrong /opt/jboss/.m2/repository location, so getting GAV 'com.example:rules:1.0.0-SNAPSHOT' not found in the Maven repository. Are you sure you want to deploy it?

Maven Exec plugin, ClassLoader ClassNotFoundException

I've tried many suggestions on StackOverflow, and tested with many combinations of setup and pom.xml for 3 days, none of them works. Please help.
I started with a big project with a lot of dependencies, spring-boot, hibernate, etc. Then I create another small console project which import and use some classes from the big project. They are not parent and child project. All I do is add <dependency/> to the child project pom, like this.
P.S. the big project has a <parent/> spring-boot-starter-parent and use spring-boot-maven-plugin.
<dependency>
<groupId>myGroup</groupId>
<artifactId>bigProject</artifactId>
<version>1.0.1</version>
</dependency>
This works on Eclipse with m2e, I just use "Run as" java application and the small project works.
But I need to upload and run those project on my linux VM, which does not use GUI and Eclipse, only terminal.
Then after some reading, I try to use maven exec plugin to run the small project. My steps:
1. do mvn clean install on the big project, confirmed that it appears in my /.m2, local repository.
2. run mvn compile on small project
3. run mvn exec:java on small project
It fails on step 2, those import ... in the class of small project throw package xxx does not exist. maven fail with compilation error.
Then, I try to simplify the problem. I create two test projects with only 1 class, myLib and HelloWorld console application, then I add myLib dependency (pom). HelloWorld project to print a message from the class in myLib package. run step 1 to 3. It works.
public class App
{
public static void main( String[] args )
{
//SystemLog from big project, does not work
//SystemLog log = new SystemLog();
//log.setValue("test value");
//System.out.println(log.getValue());
//CustomMessage from myLib, works fine
CustomMessage cm = new CustomMessage();
cm.setTheMessage("custom message");
System.out.println(cm.getTheMessage() );
System.out.println(CustomMessage.defaultMsg);
}
}
pom.xml of small project
<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>test</groupId>
<artifactId>dependOnOthers</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>dependOnOthers</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>test</groupId>
<artifactId>myLibrary</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com</groupId>
<artifactId>bigproject</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>test.dependOnOthers.App</mainClass>
<!-- <arguments> <argument>argument1</argument> </arguments> -->
<!-- <arguments> <argument>-classpath</argument> <argument>target/lib/bigproject-1.0.1.jar</argument>
</arguments> -->
</configuration>
</plugin>
</plugins>
</build>
</project>
Then I add a reference to big project, try to print a log message using HelloWorld, it pass step 2, mvn compile, but when I do step 3, mvn exec:java, java.lang.ClassLoader.loadClass() throw ClassNotFoundException on the line where I new an SystemLog() instance, the class defined in big project.
Summarize:
Goal: try to run a console application using Maven exec plugin, which has a dependency on another project, that is installed in local repo /.m2
The SystemLog class is a model class with hibernate annotations.
1. small project depend on big project, fail on mvn compile, package does not exist.
2. HelloWorld depend on myLib, works fine.
3. HelloWorld depend on big project, fail at runtime with ClassNotFoundException.
It's a little late but i ran in the same error, migrating a project from 1.5.3 to 2.1.4
I have found a solution for this problem.
Spring Boot has changed the jar structure in version 2.0.0+, so you don't need to specify your class as <mainClass>test.dependOnOthers.App</mainClass>, you need to point JarLauncher as main entry point.
When the plugin will execute the jar, java will call the main method JarLauncher and several code of spring will be called after that he reads the manifest and call the class definied in Start-Class:. in your case test.dependOnOthers.App.
<configuration>
<!-- Since version 2 of spring, the jar is packed in
another way and has his main method here, don't worry in the MANIFEST file is described which file to boot -->
<mainClass>org.springframework.boot.loader.JarLauncher</mainClass>
The old strucutre of Spring 1.0, was the classical java way todo it, so the java classloader can load it without problems and refer to the class when it is in the classpath, with the version 2.0.0+, they copy user class files and dependency into BOOT-INF, so the java classloader cannot load it anymore, you need to use the Spring classloader to get the class instance.
I have a workaround and know what is causing the problem, but don't know all the details, hope that someone will comment on this, or elaborate the answer.
The thing that cause this problem is spring-boot-maven-plugin, which I use to run spring-boot embedded tomcat server, using mvn spring-boot:run. This plugin seems to change something on the .jar file, maybe the manifest?
The workaround is to remove this plugin, run mvn clean install, that .jar installed in local repository will work correctly. run mvn compile on the small project. Then add the plugin back to big project, run mvn spring-boot:run
I do not know what the plugin changes that result in a .jar with package not exist, does it changes package name?
My workaround is clumsy, if there is a way to choose to compile with or without spring-boot-maven-plugin by defining maven goal, so that I do not need to change the pom for different build (with/without plugin). That would be a better solution.

No Jar found in /WEB-INF/lib after deploying maven project from eclipse to wildlfy9

I am seeing a very strange behavior of wildfly9.x. Build process goes successful. after clicking on RUN AS -> Run on Server(WildFly9.x). It shows exception like NO class def found.
I have already added dependency in POM.xml and its scope is compile.
POM.xml file:
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.6</version>
<scope>compile</scope>
</dependency>
Exception:
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64 from [Module "deployment.worldportfolio.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
Thanks in advance.
I solved it by myself. If you want to run wildfly server from eclipse IDE so you should follow this a very simple method create lib folder in WEB-INF and place all the required Jars in the lib folder. You are done.

javax/validation/Path GWT Java Maven converstion

I am using GWT in my project., recently I tried converting a manual compilation of GWT + Java + tomcat to a maven project., almost I am able successfully package it to a war., BUt when I deployed on tomcat I got followin error:
EVERE: Exception while dispatching incoming RPC call
java.lang.NoClassDefFoundError: javax/validation/Path
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.google.gwt.user.server.rpc.SerializationPolicyLoader.loadFromStream(SerializationPolicyLoader.java:196)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.loadSerializationPolicy(RemoteServiceServlet.java:90)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doGetSerializationPolicy(RemoteServiceServlet.java:293)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.getSerializationPolicy(RemoteServiceServlet.java:157)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.prepareToRead(ServerSerializationStreamReader.java:455)
Here is what i added for my added in my pom.xml:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
as dependencies.
Kindly help me.
What I need to add more to resolve the issue?
It is the dependency scope that is causing the problem. compile is actually the default scope so this could be omitted from the first dependency if you want.
The problem is in the second artifact which is declared as provided. This means that the application is expecting the web container to provide that library/classes. It looks like it is not providing the required classes, which results in the NoClassDefFoundError.
Removing the <scope>provided</scope>, will instruct Maven to package that library with the application and Tomcat should be able to get past that error.
There are no compile-time errors since the gwt-user is available at compile time. It is simply not available at run-time for Tomcat.