Hi,

Thank you for the prompt reply. I've tried ur method, but the problem
doesn't go away.

java.lang.NullPointerException
        at org.exolab.castor.jdo.engine.JDOClassDescriptor.<init>(Unknown
Source)
        at
org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(Unknown
Source)
        at
org.exolab.castor.mapping.loader.MappingLoader.loadMapping(Unknown Source)
        at org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(Unknown
Source)
        at org.exolab.castor.mapping.Mapping.getResolver(Unknown Source)

      at org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(Unknown
Source)
        at org.exolab.castor.jdo.JDO.getDatabase(Unknown Source)
      ...

The problem line of code becomes "db = jdo.getDatabase();"

I am using JBuilder7, and my file structure looks something like this:

/classes
  /com
    <copy of files at /xml>
    accounts.xml   <sample data>
    acctConfig.xml <Config file>
    acctMap.xml    <mapping file>
    /data
      <where the generated classes from Source Generator are stored>
      Acct.class
      AcctDescriptor.class
      AcctType.class
      AcctTypeDescriptor.class
      Desk.class
      DeskDescriptor.class
      DeskType.class
      DeskTypeDescriptor.class
    /sqlTest
      <where the testing program's classes are stored>
      AcctProcessor.class
      testAcct.class
/src
  /com
    /data
      <where the generated java files from Source Generator are stored>
      Acct.java
      AcctDescriptor.java
      AcctType.java
      AcctTypeDescriptor.java
      Desk.java
      DeskDescriptor.java
      DeskType.java
      DeskTypeDescriptor.java
    /sqlTest
      <where the testing program's java files are stored>
      AcctProcessor.class
      testAcct.class
/xml
  <where the xml files are stored>
  accounts.xml   <sample data>
  acctConfig.xml <Config file>
  acctMap.xml    <mapping file>

Are there any other problems in my files that might cause the Null Pointer
Exception?

--Johnny


-----Original Message-----
From: Bruce Snyder [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 03, 2002 3:44 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] jdo setConfiguration problem with sybase


This one time, at band camp, Fong, Kakeungjohnny said:

FK>I have been trying to use Castor with Sybase, and here is the java code
for
FK>connecting the database:
FK>
FK>      // Define the JDO object
FK>      jdo = new JDO();
FK>      jdo.setClassLoader( getClass().getClassLoader() );
FK>      jdo.setConfiguration("acctConfig.xml");

Johnny,

Where does acctConfig.xml reside on the file system? Based on the above
code, unless it's in the directory from which the Java application is
launched, Castor will not find it.

A better strategy for locating it is to make use of: 

    getClass().getResource() - this will require that acctConfig.xml reside
    where the calling .class resides

    getClass().getClassLoader().getSystemResource() - this will locate
    acctConfig.xml on the CLASSPATH

Bruce
-- 
perl -e 'print
unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

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