title: Create and download excel
body: <p>I'm using Wildfly 10.0 and <a href="https://poi.apache.org/spreadsheet/" rel="nofollow noreferrer">Apache POI</a> to develop my application.
  I'd like to create and download an excel file but it does not seem to work.</p>
  
  <p>This is my code:</p>
  
  <pre><code>package it.example.api;
  
  import java.io.FileOutputStream;
  import java.io.IOException;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.QueryParam;
  
  import org.apache.poi.ss.usermodel.Cell;
  import org.apache.poi.ss.usermodel.Row;
  import org.apache.poi.ss.usermodel.Workbook;
  import org.apache.poi.xssf.usermodel.XSSFSheet;
  import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  
  import it.example.entity.Report;
  import it.oss.base.media.MediaType;
  
  @Path("/excel")
  public class ExampleExcel {
  
  @GET
  @Path("/test")
  @Produces(MediaType.APPLICATION_JSON)
  public void workbook() throws IOException {
  
       XSSFWorkbook workbook = new XSSFWorkbook();
       XSSFSheet sheet = workbook.createSheet("Java Books");
       Object[][] bookData = { { "Head First Java", "Kathy Serria", 79 }, {
       "Effective Java", "Joshua Bloch", 36 },
       { "Clean Code", "Robert martin", 42 }, { "Thinking in Java", "Bruce Eckel", 35 }, };
  
       int rowCount = 0;
       for (Object[] aBook : bookData) {
       Row row = sheet.createRow(++rowCount);
       int columnCount = 0;
       for (Object field : aBook) {
       Cell cell = row.createCell(++columnCount);
       if (field instanceof String) {
       cell.setCellValue((String) field);
       } else if (field instanceof Integer) {
       cell.setCellValue((Integer) field);
       }
       }
       }
  
       try (FileOutputStream outputStream = new
       FileOutputStream("Books.xlsx")) {
       workbook.write(outputStream);
       }
  }
  
  }
  </code></pre>
  
  <p>My server is started as you can see:
  <a href="https://i.stack.imgur.com/UZ5yp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UZ5yp.png" alt="Image1"></a></p>
  
  <p>I can't create and download the file when I go to <a href="http://localhost:8080/my-skeleton/api/excel/test" rel="nofollow noreferrer">http://localhost:8080/my-skeleton/api/excel/test</a>, path is correct.</p>
  
  <p>Can someone explain to me where I'm wrong?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>Edit</strong>
  The error is:</p>
  
  <pre><code>ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-20) RESTEASY002010: Failed to execute: javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost:8080/my-skeleton/api/excel/report
  at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:114)
  at org.jboss.resteasy.core.registry.RootNode.match(RootNode.java:43)
  at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
  at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:445)
  at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:257)
  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:194)
  at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
  at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
  at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
  at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
  at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
  at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
  at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
  at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
  at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
  at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
  at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
  at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
  at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
  at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
  at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
  at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>