Finally got it to work.  Once I thought about it and looked at the
exception I realized that the mapping was being loaded. I looked into the
mapping file and found a space in front of the definition for SignInRole.

Conclusions:  I can't see another way of using CASTOR on the j2ee 1.3
architecture other than binding the JDO to the jndi.
I see  potential problems with the dynamic classloaders if another approach
is used.

Trying to put copies of the mapping files in the WEB-INF will work for
servlets but not for EJB's.  I don't think EJB can see the WEB-INF/classes
directory - but I could be wrong.  Putting the mapping files in the ejb
jars and the web-inf/classes directory is obviously a bad idea.

If weblogic startup classes are used then there are additional problems.

Correct me if I'm wrong but the cleanest approach, the path of least pain,
is binding a jdo to the jndi tree.  Hopefully there aren't any performance
hits with this approachs.

Hope someone has a little less pain than I had with this.
Its saturday, my immediate problem is SOLVED, and I am outta here.





                                                                                       
                                   
                    "Ebersole, Steven"                                                 
                                   
                    <steven.ebersole@vig        To:     [EMAIL PROTECTED]          
                                   
                    nette.com>                  cc:                                    
                                   
                                                Subject:     Re: [castor-dev] 
JNDI/JDO:  can't find a class when using a  
                    04/19/2002 01:45 PM         jdo r   etrieved from jndi             
                                   
                    Please respond to                                                  
                                   
                    castor-dev                                                         
                                   
                                                                                       
                                   
                                                                                       
                                   



Machine 160.129.239.236 is where you mount the JDO into the JNDI.  Is it
also the machine from which you try to access that JDO?

If not, I have never gotten that part to work (although I get a different
error).  I have only ever been able to access the JDO from the same machine
as where it is bound into the JNDI tree.

I ask because you are explicitly giving the connect parameters on
InitialContext creation which is not necessary if on the same box (in the
same wl instance).



********************************************
Steve Ebersole
IT Integration Engineer
Vignette Corporation
512.741.4195

Visit http://www.vignette.com

********************************************


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Friday, April 19, 2002 1:30 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] JNDI/JDO: can't find a class when using a jdo
retrieved from jndi


I'm using weblogic 6.1 and have verified that the jdo is being bound to the
jndi tree.
Its also being retrieved as is verifiable from the stack trace below.

Maps and database files are fine.  This was working prior to my trying the
jndi/j2ee method
All classes except the stubs and skeltons for the ejbs are in the
serverclasses directory which is in the system classpath.
Another copy of the files are in WEB-INF/classes
The class in question SignInRole is also in the ejb jar

Any ideas


catch (DatabaseNotFoundException e)
    {
      EDWhiteboardLog.error("**** BaseDAO constructor : DB not found",e);
      e.printStackTrace();
      throw e;
    }

This is  displayed the error displayed int catch above

####<Apr 19, 2002 1:16:53 PM CDT> <Error> <EDWhiteboard> <MSP-IFM-YSZK836>
<edisServer> <ExecuteThread: '13' for queue: 'default'> <> <> <000000>

<**** BaseDAO constructor : DB not found Nested error:
org.exolab.castor.mapping.MappingException: Could not find the class
vanderbilt.ed.signin.SignInRole>
org.exolab.castor.mapping.MappingException: Could not find the class
vanderbilt.ed.signin.SignInRole
     at
org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingLoade

r.java:309)
     at
org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(JDOMappingLoa

der.java:147)
     at
org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoader.jav

a:220)
     at
org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(JDOMappingLoader.j

ava:295)
     at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:278)
     at
org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.

java:317)
     at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:583)



This is what I'm using to bind the jdo to the jndi tree.



package vanderbilt.ed.utils;

import java.io.PrintWriter;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.Context;
import org.exolab.castor.jdo.JDO;
import org.exolab.castor.util.Logger;
import weblogic.common.T3ServicesDef;
import weblogic.common.T3StartupDef;
import vanderbilt.ed.utils.EDWhiteboardLog;
public class ConfigureJDO implements T3StartupDef
{
  public String _wlTransactionManager
= "weblogic.transaction.TransactionManager";
  public String _databaseType = "oracle";
  public String _jndiName = "ConfigureJDO";
  public String _databaseConfigFile;
  public T3ServicesDef _services;
  public String _loggingKey      = "ConfigureJDO.startup()";
  public InitialContext _context = null;
  public JDO _jdo                = null;

  public ConfigureJDO()
  {
  }

  public void setServices(T3ServicesDef services)
  {
    _services = services;
  }

  public String startup(String name, Hashtable args) throws Exception
  {
    _loggingKey      = "ConfigureJDO.startup()";

    Hashtable ht = new Hashtable();

ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactor

y");
    ht.put(Context.PROVIDER_URL, "t3://160.129.239.236:7001");
    _context = new InitialContext(ht);

    if (!(args != null && args.containsKey("databaseConfigFile")&&
args.containsKey("databaseType")) )
    {
      EDWhiteboardLog.info("ConfigureJDO: invalid parameters");
      return null;
    }

    _databaseConfigFile = (String)args.get("databaseConfigFile");
    _databaseType = (String)args.get("databaseType");

    EDWhiteboardLog.info("databaseConfigFile = " + _databaseConfigFile);
    EDWhiteboardLog.info("databaseType = " + _databaseType);
    EDWhiteboardLog.info("Location of databasePool.xml " + (String)getClass
().getResource(_databaseConfigFile).toString());
//    PrintWriter writer = new Logger(System.out).setPrefix(jndiName);
    ClassLoader klassLoader = this.getClass().getClassLoader();

    _jdo = new JDO();

//    jdo.setLogWriter(writer);
    _jdo.setDatabaseName(_databaseType);
    _jdo.setConfiguration(getClass().getResource
(_databaseConfigFile).toString());
    _jdo.setTransactionManager(_wlTransactionManager);
    _jdo.setClassLoader(klassLoader);
/*      System.out.println("BaseDAO() start");
      _jdo = new JDO();
  //    writer = new Logger(System.err).setPrefix("BaseDAO:");
//      _jdo.setLogWriter(writer);
      _jdo.setDatabaseName(DATABASE_TYPE);
      _jdo.setConfiguration(getClass().getResource
("/databasePool.xml").toString());
      _jdo.setClassLoader(getClass().getClassLoader());
*/


    // register JDO in JNDI
    EDWhiteboardLog.info("Binding JDO to JNDI:  " + _jndiName);
    try
    {
        EDWhiteboardLog.info("JDO Reference:  " + _jdo);
      _context.rebind(_jndiName, _jdo.getReference());
    }
    catch (Exception e)
    {
      EDWhiteboardLog.error("ConfigureJDO :",e);
      System.exit(3);
    }
    return "JDO created and bound to jndi";
  }
}

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
           unsubscribe castor-dev

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
           unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to