You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peeths <an...@yahoo.co.in> on 2005/06/22 12:18:47 UTC

read this: cocoon , ejb and jboss

hi all ,

read this , working on cocoon .


Integrating cocoon with jBoss
Download cocoon-war-2.1.7.war and then we have to
deploy that to the jboss server , to deploy that , we
started jboss server in standard mode and then copied
the cocoon war file to
/usr/local/jboss-4.0.0/server/standard/deploy/ folder
and in the server console we got the message saying
that the perticular war file is being deployed .Then
run the cocoon home page using
http://localhost:8080/cocoon-war-2.1.7/ .

Deploying ejb in cocoon
To  deployment ejb in cocoon you should have an ejb
container , so we have to integrate ejb with any
application server , here we are using jBoss server.
Here i'm using a js (java script ) file to invoke an
ejb client , i'm using the command 

   var query = new Packages.hibernate.logging.Query();

where hibernate.logging is the package and Query is
the bean's client , and Packages is the inbuilt
keyword for accessing packages. Then from the client
you can call the bean class as we normally calling the
bean. If you are using data base in the bean you have
to configure the cocoon.xconf file as 

<datasources>
 <jdbc logger="core.datasources.personnel"
name="personnel">
      <pool-controller max="10" min="5"/>
      <dburl>jdbc:hsqldb:hsql://localhost:9002</dburl>
      <user>sa</user>
      <password/>
 </jdbc>
	
 <jdbc name ="hibernatedbds">
  <pool-controller min = "5" max = "10" />
 
<dburl>jdbc:postgresql://192.168.0.129:5432/hibernatedb</dburl>
  <user>xxxxx</user>
  <password/>
  </jdbc>

and in the bean calss we can access the database as 

public String xxxxxxx(String user, String
password,Session session) throws RemoteException
	{
	try
	{

	if(session == null)
		System.out.println("Session is null");
			
	Transaction tx = session.beginTransaction();
	org.hibernate.Query q =  session.createQuery("from 
hibernate.logging.User as user where user.users =
:users and 	user.password = :passwords");
	q.setString("users",user);
	q.setString("passwords",password);
	List  list = q.list();
	tx.commit();
	if(list.isEmpty())
		return "false";
	}
	catch(Exception e)
	{
		e.printStackTrace();
	}
		System.out.println("Called EJB");
		return "true";
	}

and in the client program we'll give 
String value = remote.Validate(user,password,session);

to access the remote method

when the program is ready and compiled create the jar
file and then deploy it to the deploy folder of jboss
and a copy od the same jar file to the
cocoon/WEB-INF/lib/. Then you can run the program .

regards
Peeths


		
__________________________________________________________
How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com

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