ServletException: ClassNotFoundException org.eclipse.jetty.websocket.server.WebSocketServerFactory - java

I set up a Websocket Server that is supposed to run a servlet wich is created by a websocket servlet factory.
However, whenever I try to reach the websocket via my favourite browser I get
HTTP ERROR: 500
Problem accessing /test/sound. Reason:
javax.servlet.ServletException: java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketServerFactory
The server console gives similar errors. Heres the complete console error message:
[13:21:26 WARN]: 2015-08-27 13:21:26.912:WARN:/test:qtp20972561-41: unavailable
java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketSe
rverFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jetty.websocket.servlet.WebSocketServletFactory$Loader.lo
ad(WebSocketServletFactory.java:63)
at org.eclipse.jetty.websocket.servlet.WebSocketServletFactory$Loader.cr
eate(WebSocketServletFactory.java:42)
at org.eclipse.jetty.websocket.servlet.WebSocketServlet.init(WebSocketSe
rvlet.java:128)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.jav
a:612)
at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java
:468)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:778
)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java
:587)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandl
er.java:1125)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:
515)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandle
r.java:1059)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j
ava:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper
.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.jav
a:248)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java
:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPoo
l.java:620)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool
.java:540)
at java.lang.Thread.run(Unknown Source)
[13:21:26 WARN]: 2015-08-27 13:21:26.913:WARN:oejs.ServletHandler:qtp20972561-41
:
javax.servlet.ServletException: java.lang.ClassNotFoundException: org.eclipse.je
tty.websocket.server.WebSocketServerFactory
at org.eclipse.jetty.websocket.servlet.WebSocketServlet.init(WebSocketSe
rvlet.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.jav
a:612)
at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java
:468)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:778
)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java
:587)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandl
er.java:1125)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:
515)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandle
r.java:1059)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j
ava:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper
.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.jav
a:248)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java
:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPoo
l.java:620)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool
.java:540)
at java.lang.Thread.run(Unknown Source)
Caused by:
java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketSe
rverFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jetty.websocket.servlet.WebSocketServletFactory$Loader.lo
ad(WebSocketServletFactory.java:63)
at org.eclipse.jetty.websocket.servlet.WebSocketServletFactory$Loader.cr
eate(WebSocketServletFactory.java:42)
at org.eclipse.jetty.websocket.servlet.WebSocketServlet.init(WebSocketSe
rvlet.java:128)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.jav
a:612)
at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java
:468)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:778
)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java
:587)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandl
er.java:1125)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:
515)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandle
r.java:1059)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.j
ava:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper
.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.jav
a:248)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java
:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPoo
l.java:620)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool
.java:540)
at java.lang.Thread.run(Unknown Source)
my best bet is, that I forgot something in my pom.xml since the WebSocketServletFactory class is missing, but I am not sure.
Here are the repositories and dependencies I have in the pom.xml
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>googlecode</id>
<name>jWebSocket Repository</name>
<url>http://jwebsocket.googlecode.com/svn/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.2.5.v20141112</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.2.5.v20141112</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId>
<version>9.2.5.v20141112</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
</dependencies>
How can I resolve this error? If any more source is required please request it.

I finally answered my question by myself. The issue could be resolved by adding the classpaths to the missing jars in the META-INF/manifest.mf file.
Maybe I should've mentioned that I tried to run a jetty-server on a minecraft server via a bukkit plugin. Works fine now. Appearently this is the proper way to add external libaries to a bukkit plugin.
Thanks to everyone who anwered/commented.

Note: this answer assumes you are using jetty-distribution and normal
webapps (WAR) files.
No Jetty classes should be in your war file's WEB-INF/lib or
WEB-INF/classes, hence the <scope>provided</scope> setup.
With jetty-distribution 9.x be sure you have --module=websocket setup in your ${jetty.base}/start.ini
If you are writing for the jetty native websocket api, use this ...
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-api</artifactId>
<version>9.3.2.v20150730</version>
<scope>provided</scope>
</dependency>
If you are wanting servlet support for the jetty native websocket api use this ...
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-servlet</artifactId>
<version>9.3.2.v20150730</version>
<scope>provided</scope>
</dependency>
If you are wanting client support for the jetty native websocket api use this ...
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId>
<version>9.3.2.v20150730</version>
<scope>provided</scope>
</dependency>
If you are writing against the javax.websocket.server server API, use the following (Note: this includes the javax.websocket client API as-well) ...
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
If you are writing against the javax.websocket client only API, use the following ...
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-client-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
The suggestions below are only valid for embedded-jetty use of WebSocket and javax.websocket (JSR-356) support.
If you are wanting javax.websocket.server (aka JSR-356 server) support use this ...
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-server-impl</artifactId>
<version>9.3.2.v20150730</version>
<scope>provided</scope>
</dependency>
If you are wanting javax.websocket (aja JSR-356 client) support use this ...
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-client-impl</artifactId>
<version>9.3.2.v20150730</version>
<scope>provided</scope>
</dependency>
And other references to websocket artifacts in your pom are useless and pointless, don't use em.

Related

java.lang.NoClassDefFoundError: Failed to link org/pentaho/di/core/attributes/metastore/EmbeddedMetaStore

I'm building a batch with Pentaho Kettle to process some files. This batch is started by a servlet. However, when I try to start it, I get the following warn which actually block the process:
WARN [org.jboss.modules] (Batch Thread - 2) Failed to define class org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore in Module "deployment.my-program-1.0.0.0-SNAPSHOT.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link org/pentaho/di/core/attributes/metastore/EmbeddedMetaStore (Module "deployment.my-program-1.0.0.0-SNAPSHOT.war:main" from Service Module Loader): org/pentaho/metastore/api/BaseMetaStore
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:605)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at org.pentaho.di.base.AbstractMeta.<init>(AbstractMeta.java:162)
at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:201)
at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:755)
However, when I look in my lib folder, the jar containing this class (kettle-engine-8.2.0.0-342.jar) is there and the class is also in it.
I'm using a JBoss EAP 7.0 with Java 1.8.0.161 on my computer for development. I start it with my IDE (Eclipse Photon). Here are my dependencies in the pom.xml:
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<!-- vf2 debug -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.2</version>
</dependency>
<!-- maven-war-plugin-->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</dependency>
<!-- pentaho kettle -->
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-core</artifactId>
<version>8.2.0.0-342</version>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-engine</artifactId>
<version>8.2.0.0-342</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>2.5.16</version>
</dependency>
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7R3</version>
</dependency>
<!-- this correct an error -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- netty version override to correct netty 3.7 bug / FYI, pentaho don't use netty anyway-->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>3.9.0.Final</version>
</dependency>
</dependencies>
Important : this issue does not occur when using previous version of kettle-core and kettle-engine (tested with 7.0).
It's an embedded call so I do not directly call this class in my code.
I do not have multiple versions of this jar in my classpath.
Another person in my company found out so i'll just answer here to close the topic.
I didn't show it here but in my dependencies I had a dependency to some custom framework from work. This framework actually included pentaho, but the 7.0 version. Then, #suresh was right when he talk about multiple version jar.
So the answer is :
Check if any dependency actually contains duplicate dependency you're calling somewhere else. To avoid this issue, use the excluding syntax in the dependency calling the wrong versions :
<exclusions>
<exclusion>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-engine</artifactId>
</exclusion>
<exclusion>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-core</artifactId>
</exclusion>
</exclusions>

Why do I get FileNotFoundException with slf4j-api-1.6.1.jar?

I'm a spring and maven newbie, and I can't make my project work... I started a new Maven project with a webapp archetype, and got it working, even with some spring security. But now I included the hibernate dependencies at maven and no matter if I keep them or delete them from pom.xml I get:
HTTP Status 500 – Internal Server Error
Type Exception Report
Message javax.servlet.ServletException: java.lang.IllegalStateException: java.io.FileNotFoundException: C:\eclipse-workspace3\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\prueba6\WEB-INF\lib\slf4j-api-1.6.1.jar (The system cannot find the file specified)
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
I get the following errors at the console:
Sep 21, 2018 5:22:08 PM org.apache.catalina.core.StandardContext backgroundProcess
WARNING: Exception processing loader [WebappLoader[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/prueba6]]] background process
java.lang.IllegalStateException: java.io.FileNotFoundException: C:\eclipse-workspace3\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\prueba6\WEB-INF\lib\slf4j-api-1.6.1.jar (The system cannot find the file specified)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:101)
at org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:256)
at org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:281)
at org.apache.catalina.webresources.Cache.getResource(Cache.java:62)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:216)
at org.apache.catalina.webresources.StandardRoot.getClassLoaderResource(StandardRoot.java:225)
at org.apache.catalina.loader.WebappClassLoaderBase.modified(WebappClassLoaderBase.java:708)
at org.apache.catalina.loader.WebappLoader.modified(WebappLoader.java:343)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:287)
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5465)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1400)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1400)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1368)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\eclipse-workspace3\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\prueba6\WEB-INF\lib\slf4j-api-1.6.1.jar (The system cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:164)
at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:149)
at org.apache.catalina.webresources.AbstractArchiveResourceSet.openJarFile(AbstractArchiveResourceSet.java:307)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97)
... 14 more
The content of my pom.xml 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>
<groupId>com.luv2code</groupId>
<artifactId>spring-security-demo</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>spring-security-demo</name>
<properties>
<springframework.version>5.0.2.RELEASE</springframework.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<!-- Spring MVC support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
<!-- Servlet, JSP and JSTL support -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I already tried to include slf4j dependency with a given version at pom.xml and no success. I read that sometimes some dependencies conflict using different slf4j versions, but I don't know how to check that! :( I guess I made a mistake that has nothing to do with hibernate, but I'm not able to find out where...
These steps worked for me:
- Stop Tomcat.
- Right click on Tomcat /Clean.
- Right click on Tomcat /Clean Tomcat work directory.
- Add the .war to Tomcat & start it.

Run As JUnit - ClassNotFoundException - BuildCommand Fix causes class resolution problems

Here's my Setup:
Eclipse Oxygen
Building and Deploying with Maven 3.3 which includes these specific dependencies for Unit Testing:
JUnit 4.4
Mockito 1.9.5
I've created a JUnit test class and added it to ($project/src/test/java).
I added this folder as a source folder and then did a Run As JUnit.
I recieve the following error:
Class not found
java.lang.ClassNotFoundException:
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:499)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:522)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
I can fix this by adding the following to the .project file Build Spec:
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
Unfortunately this seems to cause multiple errors to show up under markers for Java Server Faces, etc.
Is this really my fix or could I be missing something else? It's especialloy frustrating when you have a clean workspace before making this change to fix the "Junit" issue.
These extra dependencies need to be added to the pom.xml
<!-- JSF(MyFaces & Tomahawk) Dependencies -->
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>1.1.5</version>
<exclusions>
<exclusion>
<artifactId>javax.servlet</artifactId>
<groupId>jstl</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>1.1.5</version>
<exclusions>
<exclusion>
<artifactId>javax.servlet</artifactId>
<groupId>jstl</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.myfaces.tomahawk</groupId>
<artifactId>tomahawk</artifactId>
<version>1.1.6</version>
<exclusions>
<exclusion>
<artifactId>javax.servlet</artifactId>
<groupId>jstl</groupId>
</exclusion>
</exclusions>
</dependency>
The actual jar files can be added as an external library as well, but that would need to be done each time you create a project.

elasticsearch jackson error -- com.fasterxml.jackson.core.JsonFactory not seen although defined

com.fasterxml.jackson.core.JsonFactory isn't seen in my project-- I am getting the following Exception as root cause:
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 18 more
com.fasterxml.jackson.core.JsonFactory is in Jackson core, and this dependency is in thru elasticsearch:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.4.0</version>
</dependency>
as a resolved dependency:
snapshot
i tried putting jackson-core directly as a dependency in pom.xml and it didn't help.
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.6</version>
</dependency>
what am i missing?
manually removed fasterxml from maven repository .m2 on disk and had Maven download again-- Update Maven. worked.
there was a funny looking file in that folder.

Errors in using Datanucleus Rest API

When I do a Http POST to a Datanucleus Rest resource in my local Appengine developement server, the server throws this error:
Caused by: java.lang.ClassNotFoundException: org.datanucleus.NucleusContext
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:423)
at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 37 more
From what it seems, using Datnuclues Rest API on appengine is not permitted by the platform?
EDIT:
Datanucleus in the pom:
<dependency>
<groupId>com.google.appengine.orm</groupId>
<artifactId>datanucleus-appengine</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.0-release</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>3.0.0-release</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0</version>
</dependency>
<!-- Required by Datanucleus REST API -->
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rest</artifactId>
<version>2.0.0-release</version>
</dependency>
<dependency>
<groupId>net.sf.flexjson</groupId>
<artifactId>flexjson</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-json</artifactId>
<version>2.0.0-release</version>
</dependency>
Here are the DN-related jars in the WEB-INF/lib folder:
datanucleus-rest-2.0.0-release.jar
datanucleus-json-2.0.0-release.jar
datanucleus-core-3.0.0-release.jar
datanucleus-appengine-2.0.0.jar
datanucleus-api-jpa-3.0.0-release.jar
EDIT:
Fixed the initial problem by using v3.0 DN dependencies.
However, now when I try to access the REST resource from the DN servlet it throws this error:
Error : An error occurred trying to instantiate an instance of the API adapter "org.datanucleus.api.jdo.JDOAdapter" (perhaps you dont have the requisite datanucleus-api-XXX jar in the CLASSPATH?) : {1}
org.datanucleus.exceptions.NucleusUserException: Error : An error occurred trying to instantiate an instance of the API adapter "org.datanucleus.api.jdo.JDOAdapter" (perhaps you dont have the requisite datanucleus-api-XXX jar in the CLASSPATH?) : {1}
So you use some version of datanucleus-api-rest (presumably 3.x) and you don't have the requisite version of datanucleus-core (also 3.x) present. That is normally what a ClassNotFoundException means

Categories