EJB 3.1 in war package in WEB-INF/classes - javax.ejb.CreateException: Could not create stateless EJB

末鹿安然 提交于 2019-12-01 21:54:55

It is similar to glassfish bug, but I am not sure .

Hard to say, especially since you didn't provide the stacktrace for the NoClassDefFoundError, but the scenario seems different anyway.

Q1: is it passable to use ejb beans packaged in war (specification sad that is true)?

Definitely. You can either put EJB classes in WEB-INF/classes or package them as EJB-JAR and put them in WEB-INF/lib. I have several demo applications doing this.

Q2: should I describe some configuration by ejb-jar.xml ?

No, nothing forces you to do so.

Q3: what could be a cause of a problem?

The problem is that I couldn't reproduce the problem... I've deployed your EJB in a webapp with [ejb, jpa, web, webservices, weld] engines enabled (I just modified it to insert an Entity of mine in the scheduled method) and it just works. Tested with an up-to-date version of GlassFish 3.0.1. So I suspect a mistake or configuration problem on your side.

Just in case, can you provide the output of jar xfv yourapp.war (and also show your web.xml)?

kislo_metal

See: CDI with ejb 3.1 , weld-logger on glassfish v3.0.1 There I Describe step to reproduce this issues.

As I understand - there is no possibility to use CDI & EJB in one web module packaged in ear archive together and deployed t glassfish 3.0.1.

Current design is to separate ejb and war module - at least it works for me.

EJBs packaged in a WAR are using the web / lite profile of EE6. As far as I know, timers and some other features are not supported in this profile. So if you want to use timers you would have to package your ejbs in the traditional ejbjar + war + ear way.

I could not find a reference for the web profile, this is the closest to a comparison: http://www.theserverside.com/news/1321142/Part-Three-New-Features-in-EJB-31

Edit: I stand corrected, war packaging is actually described in jsr 318, EJB 3.1. Since I could not find any restrictions on available features in that section of the spec, timers should also work in an ejb packaged in a war.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!