Regards, Christophe
Armin Waibel wrote:
Hi Christophe and Lucy,
I add your guide with minor modifications to OJB deployment doc. Could you please review the doc? Find it on CVS http://cvs.apache.org/viewcvs.cgi/db-ojb/xdocs/deployment.xml
regards, Armin
----- Original Message ----- From: "Christophe Lombart" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Tuesday, March 18, 2003 10:36 PM Subject: Re: Deploy OJB in WebLogic Server
Just to complete the information provided by Lucy, you can find herehow
to deploy OJB (PB) on weblogic. It is quite similar to Jboss.guide
I think Thomas should be interested to receive this small install
for weblogic (Tested only on Weblogic 7):ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFacto
1. Add the OJB jar files and depedencies into the Weblogic classpath. 2. Compile the following classes (see at the end of this mail) and add them to the weblogic classpath. 3. Register via the weblogic console the startup class (OjbPbStartup). The JNDI name and the OJB.properties file path can be specified as parameters in this startup class (see the code). 4. As usual create the connection pool and the datasource. 5. Check the following entries in the OJB.properties :
ryManagedImpl
OJBTxManagerClass=org.apache.ojb.odmg.JTATxManagerJTATransactionManagerClass=org.apache.ojb.otm.transaction.factory.Weblog
icTransactionManagerFactory
6. Modify the connection information in the repository.xml (specifythe
datasource name):className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImp
<jdbc-connection-descriptor jcd-alias="default" default-connection="true" platform="Hsqldb" jdbc-level="2.0" jndi-datasource-name="datasource_demodb" eager-release="false" batch-mode="false" useAutoCommit="0" ignoreAutoCommitExceptions="false" > <sequence-manager
l">
<attribute attribute-name="grabSize"attribute-value="20"/>
</sequence-manager>samples.
</jdbc-connection-descriptor>
7. Write a session bean similar to thoses provided for the JBOSS
I'm interesting to know if someone make a small comparaison betweenEJB
------------CMP 2.0 and OJB in term of performance, development cost, lifecycle, cache management... It should interesting for my current project.
Thanks, Christophe
----------------------------------------------------------------------
OjbPbFactory------------
----------------------------------------------------------------------
package org.apache.ojb.weblogic;------------
import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF;
public interface OjbPbFactory {
public static String DEFAULT_JNDI_NAME = "PBFactory"; public PersistenceBrokerFactoryIF getInstance();
}
----------------------------------------------------------------------
OjbPbFactoryImpl------------
----------------------------------------------------------------------
package org.apache.ojb.weblogic;
import org.apache.ojb.broker.ta.PersistenceBrokerFactoryFactory; import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF;
/** * PB Factory wrapper class for weblogic * */ public class OjbPbFactoryImpl implements OjbPbFactory
------------public PersistenceBrokerFactoryIF getInstance() { return PersistenceBrokerFactoryFactory.instance(); }
}
----------------------------------------------------------------------
OjbStartup------------
----------------------------------------------------------------------
package org.apache.ojb.weblogic;
import javax.naming.*;
import org.apache.ojb.broker.ta.PersistenceBrokerFactoryFactory; import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF;
import weblogic.common.T3ServicesDef; import weblogic.common.T3StartupDef; import java.util.Hashtable;
/** * This startup class created and binds an instance of a * PersistenceBrokerFactoryIF into JNDI. */ public class OjbPbStartup implements T3StartupDef, OjbPbFactory
private String defaultPropsFile = "org/apache/ojb/weblogic/OJB.properties";
private T3ServicesDef services;
public void setServices (T3ServicesDef services) { this.services = services; }
public PersistenceBrokerFactoryIF getInstance() { return PersistenceBrokerFactoryFactory.instance(); }
public String startup (String name, Hashtable args) throws Exception {
try
String jndiName = (String)args.get ("jndiname"); if (jndiName == null || jndiName.length () == 0) jndiName = OjbPbFactory.DEFAULT_JNDI_NAME;
String propsFile = (String)args.get ("propsfile"); if (propsFile == null || propsFile.length () == 0)
System.setProperty("OJB.properties",efaultPropsFile );
jndiName;} else { System.setProperty("OJB.properties", propsFile ); }
InitialContext ctx = new InitialContext (); OjbPbFactory factory = new OjbPbFactoryImpl(); bind (ctx, jndiName, factory);
// return a message for logging
return "Bound OJB PersistenceBrokerFactoryIF to " +
} catch (Exception e)
same ase.printStackTrace(); // return a message for logging return "Startup Class error : impossible to bind OJB PB factory"; }
}
private void bind(Context ctx, String name, Object val) throws NamingException { Name n; for (n = ctx.getNameParser("").parse(name); n.size() > 1; n = n.getSuffix(1)) { String ctxName = n.get(0); try { ctx = (Context) ctx.lookup(ctxName); } catch (NameNotFoundException namenotfoundexception) { ctx = ctx.createSubcontext(ctxName); } } ctx.bind(n.get(0), val); }
}
Lucy Zhao wrote:
Christophe:
I'm able to deploy OJB in WebLogic Server. My approach is quite the
JNDIyours: created a weblogic startup class and bind the PBFactoryIF to
JNDItree. Here are the issues I've experienced:
1) WebLogic server seems not like the "java:/" prefix added to the
notname. It throws "javax.naming.OperationNotSupportedException: bind
problemallowed in a ReadOnlyContext; remaining name '/ojb/PBAPI'" . The
codewent away if remove "java:/" from jndi name. In the session EJB, the
could bewill be like this: pbf = ((PBFactoryIF) context.lookup("ojb.PBAPI")).getInstance();
2) In repository-database.xml, change the user id and password to :
username="system"
password="weblogic"
I guess a new user ( resembles database user id and password)
maycreated in weblogic security domain and assign it to a certain group
foralso work. But haven't tried.
Please let me know if this helps.
Cheers! Lucy Zhao
-----Original Message----- From: Christophe Lombart [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 7:44 PM To: OJB Users List Subject: Re: Deploy OJB in WebLogic Server
I'm trying to do this via a weblogic startup class. Via this startup class, I'm putting the PB factory into a JNDI tree. This part is working but I got an exception whith the datasource and I don't understand why : SecurityPrivilegeActionException. In a session bean, I lookup to the PB facotry and try to execute a query. At this time, I got this exception.
Christophe
Lucy Zhao wrote:
Have anybody deployed OJB in a WebLogic Server? And wrote an MBean
WebLogic Server?
Thanks!
Lucy Zhao
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
