Christophe:

I started my prototype with CMP. With the help of xdoclet, it still takes
much longer time to create and maintain a CMP than OJB. The line of code for
CMP (with xdoclet) is twice as much as OJB. Also the developer must know how
CMP behaves under different configuration in different application servers.
CMP doesn't give the enough power of SQL, for example, there is no "like"
for EJBQL. For OJB, I'm using Torque to generate repository.xml, VO object
and ojb code. 

About performance, I used Grinder for load testing. The HTTP
request/response time is very minimal under 25 simulated users who are doing
CRUD functions. I can give you the data if you want. My only concern is that
the "select all" call is quite slow and I'm wondering if there is any mothed
in OJB API that will return a configurable amount of records. But for
create, update, delete and select by calls, performance is very good.

Cheers,
Lucy

-----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.ConnectionFactoryMa
nagedImpl
    OJBTxManagerClass=org.apache.ojb.odmg.JTATxManager
    
JTATransactionManagerClass=org.apache.ojb.otm.transaction.factory.WeblogicTr
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.SequenceManagerNextValImpl">
            <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]
>
>  
>

Reply via email to