I am trying to make a simple demo with java servlets. When I run a TomEE server on localhost it fails with the errors:
java.lang.Exception: deployment not found: openejb/Deployer
at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:2366)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1100)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:759)
at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:637)
at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:494)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:307)
at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:245)
at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:169)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:137)
at org.apache.catalina.startup.Catalina.load(Catalina.java:584)
at org.apache.catalina.startup.Catalina.load(Catalina.java:607)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:303)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
15-Apr-2020 14:04:54.360 SEVERE [main] org.apache.openejb.assembler.classic.Assembler.destroyApplication undeployException original cause
java.lang.Exception: deployment not found: openejb/ConfigurationInfo
at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:2366)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1100)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:759)
at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:637)
at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:494)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:307)
at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:245)
at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:169)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:137)
at org.apache.catalina.startup.Catalina.load(Catalina.java:584)
at org.apache.catalina.startup.Catalina.load(Catalina.java:607)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:303)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
15-Apr-2020 14:04:54.360 SEVERE [main] org.apache.openejb.assembler.classic.Assembler.destroyApplication undeployException original cause
java.lang.Exception: deployment not found: MEJB
at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:2366)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1100)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:759)
at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:637)
at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:494)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:307)
at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:245)
at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:169)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:137)
at org.apache.catalina.startup.Catalina.load(Catalina.java:584)
at org.apache.catalina.startup.Catalina.load(Catalina.java:607)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:303)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
15-Apr-2020 14:04:54.361 SEVERE [main] org.apache.openejb.assembler.classic.Assembler.buildContainerSystem Application could not be deployed: openejb
org.apache.openejb.OpenEJBException: Creating application failed: openejb: Error building bean 'openejb/Deployer'. Exception: class java.lang.ExceptionInInitializerError: null: null
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1104)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:759)
at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:637)
at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:494)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:307)
at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:245)
at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:169)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:137)
at org.apache.catalina.startup.Catalina.load(Catalina.java:584)
at org.apache.catalina.startup.Catalina.load(Catalina.java:607)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:303)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
Caused by: org.apache.openejb.OpenEJBException: Error building bean 'openejb/Deployer'. Exception: class java.lang.ExceptionInInitializerError: null: null
at org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder.java:85)
at org.apache.openejb.assembler.classic.Assembler.initEjbs(Assembler.java:1501)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:962)
... 18 more
Caused by: java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:415)
at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.load(EnterpriseBeanBuilder.java:429)
at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.loadClass(EnterpriseBeanBuilder.java:405)
at org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.build(EnterpriseBeanBuilder.java:82)
at org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder.java:68)
... 20 more
Caused by: org.apache.openejb.OpenEJBRuntimeException: cannot create unique file, please set java.io.tmpdir to a writable folder or create work folder
at org.apache.openejb.assembler.DeployerEjb.<clinit>(DeployerEjb.java:112)
... 26 more
Caused by: java.io.IOException: Access is denied
at java.base/java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.base/java.io.File.createNewFile(File.java:1024)
at org.apache.openejb.assembler.DeployerEjb.<clinit>(DeployerEjb.java:96)
... 26 more
I am using JDK 12 with TomEE webprofile 8.0.1. I tried to start the server from {tomee}/bin/startup.bat but unfortunately there was not any difference.
pom.xml:
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>demoServlet</groupId>
<artifactId>demoServlet</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
HomeServlet.java:
package web;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/")
public class HomeServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.getWriter().println("Hello world!");
}
}
webapp/WEB-INF/web.xml:
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app>
Project structure:
root
│──src
│──main
│ └──java
│ └──web
│ └──HomeServlet.java
│──webapp
└──WEB-INF
└──web.xml
From the stacktrace error seems permission issue in tmp dir.
Caused by: org.apache.openejb.OpenEJBRuntimeException: cannot create unique file, please set java.io.tmpdir to a writable folder or create work folder
Which means application don't have write access to tmp dir.
So you can add openejb.system.apps=false in conf/system.properties or just export CATALINA_TMPDIR to a "new tmp dir value"