Thanks for the info. Is it possible to deploying OJB in weblogic with touching classpath?
I'll be deploying OJB a weblogic environment hosting different application. Is it possible to deploy OJB that's used by EJB without touching the classpath in the startup scripts. regards Tong Kiat -----Original Message----- From: Lucy Zhao <[EMAIL PROTECTED]> To: 'OJB Users List' <[EMAIL PROTECTED]> Date: Fri, 21 Mar 2003 10:13:54 -0500 Subject: FW: Deploy OJB in WebLogic Server > > Chiah: > > Attached is a email Christophe put together on how to deploy OJB in > WebLogic > Server. > > Cheers, > Lucy > > -----Original Message----- > From: Chiah Tong Kiat [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 20, 2003 7:06 PM > To: OJB Users List; Thomas Mahler > Subject: deploying ojb with WebLogic > > > Hi > > I was trying to search the mail archive for information on deploying > OJB in > weblogic. Is there any current issue in preventing OJB from being used > in > weblogic? > > Is thee any particualr configuration in the weblogic setup that I need > to be > aware of? > > thanks > tk > -----Original Message----- > From: Christophe Lombart [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 18, 2003 4:37 PM > To: OJB Users List > Subject: Re: Deploy OJB in WebLogic Server > > > Just to complete the information provided by Lucy, you can find here > how > to deploy OJB (PB) on weblogic. It is quite similar to Jboss. > I think Thomas should be interested to receive this small install > guide > for weblogic (Tested only on Weblogic 7): > > 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 : > > ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFact > oryMa > nagedImpl > OJBTxManagerClass=org.apache.ojb.odmg.JTATxManager > > JTATransactionManagerClass=org.apache.ojb.otm.transaction.factory.Weblo > gicTr > ansactionManagerFactory > > 6. Modify the connection information in the repository.xml (specify > the > datasource name): > > <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 > className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValIm > pl"> > <attribute attribute-name="grabSize" attribute-value="20"/> > </sequence-manager> > > </jdbc-connection-descriptor> > > 7. Write a session bean similar to thoses provided for the JBOSS > samples. > > > I'm interesting to know if someone make a small comparaison between EJB > 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", defaultPropsFile > ); > } > 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 " + > jndiName; > } > catch (Exception e) > { > e.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 > same as > >yours: created a weblogic startup class and bind the PBFactoryIF to > JNDI > >tree. Here are the issues I've experienced: > >1) WebLogic server seems not like the "java:/" prefix added to the > JNDI > >name. It throws "javax.naming.OperationNotSupportedException: bind not > >allowed in a ReadOnlyContext; remaining name '/ojb/PBAPI'" . The > problem > >went away if remove "java:/" from jndi name. In the session EJB, the > code > >will 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) could > be > >created in weblogic security domain and assign it to a certain group > may > >also 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 > for > >>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]