cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <s.gia...@thebug.it>
Subject Re: How to work with EJB's
Date Fri, 10 Feb 2006 04:18:56 GMT
Hi Ankur,
yeah, Gunter is right, you can use plain java. I worked with cocoon, 
flow, cforms and EJB and these are a few tips :

- If you are going to develop flow based web-aplications, !!use javaflow 
if you can!!, under BEA weblogic and some other containers the Rhino 
classloader is not very well accepted, containers do neat stuff with 
classloaders when dealing with EJB.

- Both in javaflow and in components (actions, transformers etc..) you 
are going to develop, you can lookup the beans in the normal way:
            Context ctx = new InitialContext();
            IBeanHome beanhome = (IBeanHome) ctx.lookup(JNDI_NAME);
            result = (Bean) beanhome.create();
or whatever else you are used to, it's plain java.

- For a faster developement process, i managed to configure the EJB ear 
on BEA Weblogic, and access it trhu IIOP from the cocoon embedded jetty. 
Since BEA takes a lot of time to restart, expecially when there are many 
EJBs involved, and does not allow an easy way to replace files while 
running (and in cocoon it's so handy to do that), this can really save a 
lot of time (haven't tested other container, but i don't think they can 
do miracles, jetty will always load many times faster, and allows 
runtime file substitution). To do this i had to :
... Enable IIOP in BEA (or any other container).
... In BEA i also had to specify the listen address for IIOP 
connections, makes no sense since it was a single ip machine, but that is.
... In jetty (or cocoon jetty, under cocoon/build/webapp) create a file 
named WEB-INF/classes/jndi.properties and put this inside :

java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
java.naming.provider.url=iiop://your.bea.host/

... YMMV, but i also had to add ejb-2_1-api.jar and wlclient.jar (BEA 
web logic stuff) in WEB-INF/lib/ , and obviously a .jar with all the EJB 
classes.
... For you developement process only, add an easy java policy. Create a 
java.policy file where you prefer (WEB-INF is a good place) and put this 
in it :

grant {
permission java.security.AllPermission;
};

... The before running ./cocoon.sh servlet (or cocoon.bat servlet if in 
windows) set this environment variable :

export JAVA_OPTIONS="-Djava.security.manager 
-Djava.security.policy=build/webapp/WEB-INF/java.policy"

or under windows

SET JAVA_OPTIONS=-Djava.security.manager 
-Djava.security.policy=build/webapp/WEB-INF/java.policy

(Yes, under windows without quotes)

... Once a cocoon war is deployed inside the same EJB container where 
the beans are, there is no security policy problem.

Regards,
Simone

-- 
Simone Gianni

Gunter D'Hondt wrote:

>just use plain old java code to connect to your ejb's; cfr to 
>documentation or samples from your ejb container (websphere, weblogic, 
>...); they will give you all the necessary sample code to connect to the 
>ejb container
>
>Gunter D'Hondt
>
> 
>
>
>
>Ankur Gupta <ankur_aquarian@yahoo.com> 
>09/02/2006 15:02
>Please respond to
>users@cocoon.apache.org
>
>
>To
>Cocoon site <users@cocoon.apache.org>
>cc
>
>Subject
>How to work with EJB's
>
>
>
>
>
>
>How can i work with the EJB's, i need to call EJB's through cocoon, how 
>can i achieve that, i cannot find a source which can explain me to do 
>this.
>
>pllzzzzzzzzz help me with the problem
>
>thanx
>
>Ankur
>Relax. Yahoo! Mail virus scanning helps detect nasty viruses!
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message