Problem solved: 
I found a post by Armin on the archive (glad that's still online!)
recommending removing the T3ServicesDef from the startup class.  I did this,
and no longer get the NotSerializableException.

Now I'm getting a different classloader exception, but not specific to OJB
(have to figure out the WL classloader, much different from JBoss).

Recommendation: 
Change the sample startup class posted on the OJB website by removing the
T3ServicesDef member variable.


-----Original Message-----
From: Bates, Alex 
Sent: Wednesday, December 31, 2003 10:32 AM
To: OJB Users List
Subject: RE: Has anyone run OJB on WebLogic 8.1?



Here is some more information: in stderr (wasn't present in the log file)
there is a NotSerializableException caused by the Ojb startup class.

As you can see from the code below, the startup class does implement
Serializable.  The only interface in OJB that it's implementing that is NOT
serializable is ODMGJ2EEFactory.  But if this were a problem I'm assuming it
would have been noticed by others.


Here is the NotSerializableException stack trace from WL:

javax.naming.CommunicationException.  Root exception is
java.rmi.UnmarshalExcept
ion: failed to unmarshal cookie; nested exception is:
        java.io.NotSerializableException: weblogic.t3.srvr.T3ServerServices
        at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:294)
        at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:244)
        at weblogic.jndi.internal.ServerNamingNode_811_WLStub.bind(Unknown
Sourc
e)
        at weblogic.jndi.internal.WLContextImpl.bind(WLContextImpl.java:359)
        at javax.naming.InitialContext.bind(InitialContext.java:355)
        at
org.apache.ojb.weblogic.OjbODMGStartup.bind(OjbODMGStartup.java:89)
        at
org.apache.ojb.weblogic.OjbODMGStartup.startup(OjbODMGStartup.java:58
)
        at
weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassServic
e.java:177)


-----Original Message-----
From: Bates, Alex 
Sent: Wednesday, December 31, 2003 10:19 AM
To: OJB Users List
Subject: Has anyone run OJB on WebLogic 8.1?



I tried following the instructions in the deployment documentation for OJB,
creating a startup class for WebLogic similar to the example posted on the
website.  

I'm getting an error that WL is unable to bind the factory to JNDI.  Then,
downstream of course I get errors that ojb/defaultODMG is not bound (we're
using the ODMG API).  

Here's the error binding to JNDI, and code for startup classes.  Am I doing
something wrong?  We are trying to port to WL 8.1 for an urgent customer
request, so any help is appreciated.

--------

<Info> <<WLS Kernel>> <> <BEA-000287> <Invoking startup class:
org.apache.ojb.weblogic.OjbODMGStartup.startup(null)>
 
<Info> <WebLogicServer> <wusab210009-0n9> <myserver> <main> <<WLS Kernel>>
<> <BEA-000288> <org.apache.ojb.weblogic.OjbODMGStartup reports: Startup
Class error: impossible to bind OJB ODMG factory> 

--------

Here is the code:

public interface OjbODMGFactory extends ODMGJ2EEFactory, Serializable {

}


public class OjbODMGStartup implements OjbODMGFactory, T3StartupDef,
Serializable {

    private String DEFAULT_JNDI_NAME = "ojb/defaultODMG";
    private String defaultPropsFile =
            "org/apache/ojb/weblogic/OJB.properties";

    private T3ServicesDef services;

    public void setServices (T3ServicesDef services)
    {
        this.services = services;
    }

    public Implementation getInstance()
    {
        return OJBJ2EE_2.getInstance();
    }

    public String startup (String name, Hashtable args)
            throws Exception
    {

        try
        {
            String jndiName = (String)args.get ("jndiname");
            if (jndiName == null || jndiName.length () == 0)
                jndiName = 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 ();
            bind (ctx, jndiName, this);

            // return a message for logging
            return "Bound OJBODMGFactory to " + jndiName;
        }
        catch (Exception e)
        {
            e.printStackTrace();
            // return a message for logging
            return
                    "Startup Class error: impossible to bind OJB ODMG
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);
    }
}

--------


---------------------------------------------------------------------
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]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to