[
https://issues.jboss.org/browse/WFLY-9644?page=com.atlassian.jira.plugin....
]
Marek Kopecký updated WFLY-9644:
--------------------------------
Steps to Reproduce:
Here's my pom.xml and two source files:
{code: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>
<parent>
<groupId>jax-rs</groupId>
<artifactId>pdf.upload.topparent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<artifactId>pdf.upload.server</artifactId>
<packaging>war</packaging>
<build>
<finalName>pdfupload</finalName>
</build>
<dependencies>
<!--
https://mvnrepository.com/artifact/javax/javaee-api -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
{code}
{code:java}
package pdf.upload.server;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.UUID;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/upload")
public class PdfUploadResource {
private String uploadToDir = System.getProperty("user.home") + File.separator +
"tmp" + File.separator;
@GET
public String get() {
return "PdfUploadResource is alive";
}
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.TEXT_PLAIN)
public Response submit(@FormParam("pdfStream") InputStream pdfStream) {
try {
byte[] pdfByteArray = convertInputStreamToByteArrary(pdfStream);
String uploadedFileLocation =
uploadToDir + UUID.randomUUID().toString() + ".pdf";
writeToFile(new ByteArrayInputStream(pdfByteArray), uploadedFileLocation);
} catch (Exception ex) {
return Response.status(500).entity(ex.getMessage()).build();
}
return Response.status(200).build();
}
...
}
{code}
{code:java}
package pdf.upload.server;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/app")
public class PdfUploadApplication extends Application {
}
{code}
was:
Here's my pom.xml and two source files:
<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>
<parent>
<groupId>jax-rs</groupId>
<artifactId>pdf.upload.topparent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<artifactId>pdf.upload.server</artifactId>
<packaging>war</packaging>
<build>
<finalName>pdfupload</finalName>
</build>
<dependencies>
<!--
https://mvnrepository.com/artifact/javax/javaee-api -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
package pdf.upload.server;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.UUID;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/upload")
public class PdfUploadResource {
private String uploadToDir = System.getProperty("user.home") + File.separator +
"tmp" + File.separator;
@GET
public String get() {
return "PdfUploadResource is alive";
}
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.TEXT_PLAIN)
public Response submit(@FormParam("pdfStream") InputStream pdfStream) {
try {
byte[] pdfByteArray = convertInputStreamToByteArrary(pdfStream);
String uploadedFileLocation =
uploadToDir + UUID.randomUUID().toString() + ".pdf";
writeToFile(new ByteArrayInputStream(pdfByteArray), uploadedFileLocation);
} catch (Exception ex) {
return Response.status(500).entity(ex.getMessage()).build();
}
return Response.status(200).build();
}
...
}
package pdf.upload.server;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/app")
public class PdfUploadApplication extends Application {
}
Wildfly 11 can't deploy simple REST web service because it
can't find javax.ws.rs.core.Application
--------------------------------------------------------------------------------------------------
Key: WFLY-9644
URL:
https://issues.jboss.org/browse/WFLY-9644
Project: WildFly
Issue Type: Bug
Components: REST
Affects Versions: 11.0.0.Final
Environment: Ubuntu 16.04, JDK 1.8
Reporter: Dean Schulze
Assignee: Chao Wang
Attachments: test-app.zip
Simple JAX-RS .war file with an Application .class file (extends
javax.ws.rs.core.Application) and one resource .class file. No web.xml file. Deploying
gives this error:
Cannot upload deployment: {"WFLYCTL0080: Failed services" =>
{"jboss.deployment.unit.pdfupload.POST_MODULE" => "WFLYSRV0153: Failed
to process phase POST_MODULE of deployment \"pdfupload\" Caused by:
org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYRS0006: Could not
load JAX-RS Application class Caused by: java.lang.ClassNotFoundException:
pdf.upload.server.PdfUploadApplication from [Module \"deployment.pdfupload\"
from Service Module Loader]"}}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)