title: Deploy jar to war guide on Glassfish?
body: <p>I get strange errors while trying to deploy example war file (from jar to war guide) on Glassfish.
  In order to have a clean environment to test this I've set up a Dockerfile.</p>
  
  <p><a href="https://gist.github.com/bebud/10e8717375744018db1a#file-dockerfile" rel="nofollow">https://gist.github.com/bebud/10e8717375744018db1a#file-dockerfile</a>
  or copy this</p>
  
  <pre><code># GlassFish 3.1.2 and spring boot guide jar to war deployment
  #
  # VERSION 0.1
  # DOCKER-VERSION 1.0.0
  
  FROM dockerfile/java
  
  
  RUN apt-get update -qq
  RUN apt-get install -qq maven git
  
  WORKDIR /opt
  
  #Downloading and unpacking GlassFish 312
  RUN wget download.java.net/glassfish/3.1.2.2/release/glassfish-3.1.2.2.zip
  RUN unzip glassfish-3.1.2.2.zip
  RUN rm -f glassfish-3.1.2.2.zip
  ENV PATH /opt/glassfish3/glassfish/bin:$PATH
  RUN git clone https://github.com/spring-guides/gs-convert-jar-to-war-maven
  #Package the war file
  WORKDIR /opt/gs-convert-jar-to-war-maven/complete
  
  RUN mvn clean package
  
  RUN cp target/gs-convert-jar-to-war-maven-0.1.0.war /opt/glassfish3/glassfish/domains/domain1/autodeploy
  
  EXPOSE 8080 4848 8181
  WORKDIR /opt/glassfish3/glassfish/domains/domain1/logs
  </code></pre>
  
  <p>You can build using (example)</p>
  
  <pre><code>docker build -t user/glassfish312 .
  </code></pre>
  
  <p>and then start using </p>
  
  <pre><code>docker run -it user/glassfish312 /bin/bash
  </code></pre>
  
  <p>you need to start Glassfish domain with</p>
  
  <pre><code>asadmin start-domain
  </code></pre>
  
  <p>and view logfile with errors</p>
  
  <pre><code>less server.log
  </code></pre>
  
  <p>Here is an extract of the log I get</p>
  
  <pre><code>[#|2014-07-17T07:38:59.726+0000|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=40;_ThreadName=Thread-2;|WEB0172: Virtual server [server] loaded default web module []|#]
  
  [#|2014-07-17T07:39:00.127+0000|WARNING|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/batch/core/configuration/annotation/BatchConf
  igurer|#]
  
  [#|2014-07-17T07:39:00.138+0000|WARNING|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/batch/core/configuration/annotation/BatchConf
  igurer|#]
  
  [#|2014-07-17T07:39:00.150+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ org/springframework/jdbc/datasource/init/DatabasePopulator ] not found. Error while loading [ class org.springframework.bo
  ot.autoconfigure.jdbc.DataSourceAutoConfiguration ]|#]
  
  [#|2014-07-17T07:39:00.238+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ org/springframework/jdbc/datasource/init/DatabasePopulator ] not found. Error while loading [ class org.springframework.bo
  ot.autoconfigure.batch.BatchDatabaseInitializer ]|#]
  
  [#|2014-07-17T07:39:00.284+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ Lorg/springframework/jdbc/datasource/embedded/EmbeddedDatabase; ] not found. Error while loading [ class org.springframewo
  rk.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration ]|#]
  
  [#|2014-07-17T07:39:00.354+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ org/springframework/dao/DataAccessResourceFailureException ] not found. Error while loading [ class org.springframework.bo
  ot.autoconfigure.jdbc.CommonsDataSourceConfiguration ]|#]
  
  [#|2014-07-17T07:39:00.357+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ Lorg/apache/tomcat/jdbc/pool/DataSource; ] not found. Error while loading [ class org.springframework.boot.autoconfigure.j
  dbc.TomcatDataSourceConfiguration ]|#]
  
  [#|2014-07-17T07:39:00.359+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ com/mongodb/Mongo ] not found. Error while loading [ class org.springframework.boot.autoconfigure.mongo.MongoAutoConfigura
  tion ]|#]
  
  [#|2014-07-17T07:39:00.605+0000|WARNING|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/batch/core/configuration/annotation/BatchConf
  igurer|#]
  
  [#|2014-07-17T07:39:00.608+0000|WARNING|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/batch/core/configuration/annotation/BatchConf
  igurer|#]
  
  [#|2014-07-17T07:39:00.609+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ org/springframework/jdbc/datasource/init/DatabasePopulator ] not found. Error while loading [ class org.springframework.bo
  ot.autoconfigure.jdbc.DataSourceAutoConfiguration ]|#]
  
  [#|2014-07-17T07:39:00.611+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ org/springframework/jdbc/datasource/init/DatabasePopulator ] not found. Error while loading [ class org.springframework.bo
  ot.autoconfigure.batch.BatchDatabaseInitializer ]|#]
  
  [#|2014-07-17T07:39:00.612+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ Lorg/springframework/jdbc/datasource/embedded/EmbeddedDatabase; ] not found. Error while loading [ class org.springframewo
  rk.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration ]|#]
  
  [#|2014-07-17T07:39:00.615+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ org/springframework/dao/DataAccessResourceFailureException ] not found. Error while loading [ class org.springframework.bo
  ot.autoconfigure.jdbc.CommonsDataSourceConfiguration ]|#]
  
  [#|2014-07-17T07:39:00.617+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ Lorg/apache/tomcat/jdbc/pool/DataSource; ] not found. Error while loading [ class org.springframework.boot.autoconfigure.j
  dbc.TomcatDataSourceConfiguration ]|#]
  
  [#|2014-07-17T07:39:00.618+0000|SEVERE|glassfish3.1.2|global|_ThreadID=40;_ThreadName=Thread-2;|Class [ com/mongodb/Mongo ] not found. Error while loading [ class org.springframework.boot.autoconfigure.mongo.MongoAutoConfigura
  tion ]|#]
  
  [#|2014-07-17T07:39:01.963+0000|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=40;_ThreadName=Thread-2;|PWC1412: WebModule[null] ServletContext.log():Spring WebApplicationInitializer
  s detected on classpath: [hello.WebInitializer@7df6054f]|#]
  </code></pre>
  
  <p>It would be great to know how to be able to deploy a spring boot application on Glassfish as it is (unfortunately) the only container we are allowed to use within the corporation.</p>
  
  <p>EDIT:</p>
  
  <p>The app runs in the provided Docker container. However, our deployment tool fails due to the Exceptions.
  See server.log:</p>
  
  <pre><code>[#|2014-07-21T16:28:12.652+0200|INFO|oracle-glassfish3.1.2|javax.enterprise.system.container.web.org.glassfish.web.jsp|_ThreadID=89;_ThreadName=admin-thread-pool-47110(4);|Beginning JSP Precompile...|#]
  
  [#|2014-07-21T16:28:12.666+0200|INFO|oracle-glassfish3.1.2|javax.enterprise.system.container.web.org.glassfish.web.jsp|_ThreadID=89;_ThreadName=admin-thread-pool-47110(4);|Finished JSP Precompile|#]
  
  [#|2014-07-21T16:28:12.766+0200|INFO|oracle-glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=89;_ThreadName=admin-thread-pool-47110(4);|webops-jolokia was successfully deployed in 598 milliseconds.|#]
  
  [#|2014-07-21T16:28:20.201+0200|WARNING|oracle-glassfish3.1.2|global|_ThreadID=92;_ThreadName=admin-thread-pool-47110(5);|Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/batch/core/configuration/annotation/BatchConfigurer|#]
  
  [#|2014-07-21T16:28:20.933+0200|WARNING|oracle-glassfish3.1.2|global|_ThreadID=92;_ThreadName=admin-thread-pool-47110(5);|Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/batch/core/configuration/annotation/BatchConfigurer|#]
  
  [#|2014-07-21T16:28:20.968+0200|SEVERE|oracle-glassfish3.1.2|global|_ThreadID=92;_ThreadName=admin-thread-pool-47110(5);|Class [ org/springframework/jdbc/support/MetaDataAccessException ] not found. Error while loading [ class org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer ]|#]
  
  [#|2014-07-21T16:28:20.992+0200|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=92;_ThreadName=admin-thread-pool-47110(5);|Exception while deploying the app [example]|#]
  
  
  [#|2014-07-21T16:28:20.992+0200|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=92;_ThreadName=admin-thread-pool-47110(5);|sun.reflect.annotation.TypeNotPresentExceptionProxy
  java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
          at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673)
          at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480)
          at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306)
          at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241)
          at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
          at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
          at java.lang.Class.initAnnotationsIfNecessary(Class.java:3098)
          at java.lang.Class.getAnnotations(Class.java:3078)
          at org.glassfish.apf.impl.AnnotationProcessorImpl.processAnnotations(AnnotationProcessorImpl.java:285)
          at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:195)
          at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:134)
          at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:598)
          at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:456)
          at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:429)
          at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:405)
          at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:380)
          at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:243)
          at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:252)
          at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:213)
          at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:165)
          at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:207)
          at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:228)
          at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:109)
          at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:828)
          at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:770)
          at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)
          at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
          at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1066)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
          at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
          at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:231)
          at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:224)
          at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:323)
          at org.glassfish.admin.rest.resources.TemplateListOfResource.post(TemplateListOfResource.java:180)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
          at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
          at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
          at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
          at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
          at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
          at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
          at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
          at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
          at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
          at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
          at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
          at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
          at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
          at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
          at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
          at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
          at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
          at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
          at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
          at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
          at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
  at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:864)
          at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:761)
          at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1050)
          at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:231)
          at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
          at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
          at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
          at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
          at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
          at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
          at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
          at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
          at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
          at java.lang.Thread.run(Thread.java:722)
  |#]
  
  [#|2014-07-21T16:28:21.125+0200|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=92;_ThreadName=admin-thread-pool-47110(5);|Exception while deploying the app [example] : sun.reflect.annotation.TypeNotPresentExceptionProxy|#]
  </code></pre>