java - Servlet 2.5 injection of EJB3.0, all packaged as WAR -


i'm trying achieve goal: deploy war made of simple servlet injection of ejb, , invoke business method on it.

all made using maven project made 2 components:

1) sample ejb (pom.xml packaged ejb) 2) sample war (servlet, pom.xml packaged war. dependency ejb module)

i tell first i'm able exercise in way, packaging both war , ejb inside ear, not above mentioned one. can tell me if there limitation of used application server (weblogic 10.3.3)?

code snippet simpleservlet (war):

public class simpleservlet extends httpservlet {  @ejb(mappedname="ejb/simplesessionbean") private simplesessionremote simplesessionbean; 

code snippet simplesession remote interface (ejb):

@remote public interface simplesessionremote {     string getmessage(); } 

code snippet simplesession bean class (ejb):

@stateless(name="simplesessionejb", mappedname="ejb/simplesessionbean") @remote(simplesessionremote.class)  public class simplesession { ... 

the ejb doesn't have weblogic-ejb-jar.xml deployment descriptor, annotated ejb.

after deploy of war in admin console, null reference after direct injection in servlet.

what's wrong? did forget step?

regards, pierluigi salera

=================================

update: found answer myself

it not possible app server not supporting ejb 3.1

indeed weblogic i'm using supports ejb 3.0 stated here:

http://docs.oracle.com/cd/e14571_01/web.1111/e14529/compatibility.htm

"

weblogic server 11g release 1 (10.3.3) jee5 compatible

"

java ee 5 supports ejb 3.0 stated here:

http://download.oracle.com/otn-pub/jcp/javaee-5.0-fr-eval-oth-jspec/javaee-5_0-fr-spec.pdf?authparam=1377598866_1774a69dcb8b920f69c0c2623068e247

i have checked in ejb 3.0 specifications (jsr220), where, actually, never explicity mentioned not possible package ejb inside .war. fact not supported, believe, left implied.

to provide complete overview have checked ejb 3.1 specifications (jsr318) explicity stated "

enterprise beans can packaged within web application module (.war)"

, chapter 20 packaging.

so can conclude scope of exercise demonstrate packaging of enterprise bean in war not possible application server doesn't support ejb 3.1 specifications.

kind regards, pierluigi salera

servlet 2.5 implies java ee 5. ejb in war supported since java ee 6.

you've 2 options:

  1. upgrade java ee 6 compatible container.
  2. stick java ee 5 , create ear instead of war. ear can consist of ejb jar , war.

see also:


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -