Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-9644

Wildfly 11 can't deploy simple REST web service if specified runtime-name doesn't ends with a packing type suffix.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate Issue
    • Affects Version/s: 11.0.0.Final
    • Fix Version/s: None
    • Component/s: REST
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      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 {
      }
      
      Show
      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 { }

      Description

      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]"}}

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              soul2zimate Chao Wang
              Reporter:
              dean.w.schulze Dean Schulze (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: