Problem solved: check answer
Hello,
i am following the tutorial for jaxrs in order to make a webengine application.
But, for the moment, i experiment a crash after having following the nuxeo tutorial for jaxrs:
https://doc.nuxeo.com/810/nxdoc/webengine-jax-rs/
i get an error 500 after trying the test url:
{"entity-type":"exception","code":"com.sun.jersey.api.NotFoundException","status":500,"message":"null for uri: <a href="http://localhost:8080/nuxeo/site/mysite%22%7D" target="test_blank" rel="nofollow noopener noreferrer">http://localhost:8080/nuxeo/site/mysite"}</a> EDIT> This error was because the bundle with jaxrs was not déclared in another bundle used for compiling. But, now, there is another error, see next answer to this post.
The tomcat Log show that:
WARNING: A HTTP GET method, public java.lang.String org.nuxeo.elasticsearch.http.readonly.Main.searchWithPayload(java.lang.String,javax.ws.rs.core.UriInfo,javax.ws.rs.core.MultivaluedMap) throws java.io.IOException,org.json.JSONException, should not consume any entity.
I show you my files:
MyWebApp.java
import javax.ws.rs.core.Application;
import java.util.HashSet;
import java.util.Set;
public class MyWebApp extends Application {
@Override
public Set<Class<?>> getClasses() {
HashSet<Class<?>> result = new HashSet<Class<?>>();
result.add(MyWebAppRoot.class);
return result; }}
MyWebAppRoot.java
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("mysite")
public class MyWebAppRoot {
@GET
public Object doGet() {
return "Hello World!";
}
}
MANIFEST.****
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Manifest-Version: 1.0
Bundle-ManifestVersion: 8.10
Bundle-Name: xxx.webengine
Bundle-SymbolicName: xxx.webengine;singleton:=true
Nuxeo-WebModule: xxx.webengine.MyWebApp
pom.xml of the bundle
<?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">;
<parent>
<artifactId>xxx</artifactId>
<groupId>fr.xxxxxx.xxxc</groupId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>fr.xxxxx.xxxx.webengine</artifactId>
<name>webengine test</name>
<dependencies>
<!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api
EDIT>>> The use of this dependency was a bad idea... check answer...-->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>9.4.11.v20180605</version>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.webengine</groupId>
<artifactId>nuxeo-webengine-core</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
</dependency>
</dependencies>
</project>
One mistake could be on the maven declaration of the bundle i have created. As i am beginner with maven, i have to improve my level. In the meanwhile,
if you have a project with a webengine /jaxrs, it could helps me.
thanks