简体   繁体   中英

How do I create a Java EE container deployable JAR?

I have a main project used as a standalone batch that I want to move to the container using EJB timer (using WildFly 8.2). I thought building a WAR file with the timer class and the dependencies withing WEB-INF/lib, but doesn't sound an elegant solution because it isn't a web app, it doesn't need to bound a context. It's just a JAR, with an EJB inside and the dependencies (I'm using a fat jar) but the container throws an error when I deploy it. Should I use an EAR? Or do you guys think a WAR file is fine? PS: I'm using Maven, so possible suggestions can take it in account.

You don't really need it in a WAR file if it's not a web application, although it doesn't harms. I would also put it in a JAR file, i don't like to add something that doesn't have a meaning...it can be confusing for others. But as @Bruno César pointed out, you need to package first the EJB(s). Have a look at this ; you'll see the ways to package them as JAR, WAR, EAR.

EJB package is good solution if your standalone application has no any third party libraries. But if it has, then best solution would be EAR package type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM