You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Sven Alisch <sv...@t-online.de> on 2004/02/14 16:48:43 UTC

OK Last Question for Today!

Dear Armin,

The last question was stupid maybe, ok - i found the original 
repository.xml-file with all references. Now really, everything is in my 
classpath. My userdefined mapping i place into the repository_user.xml, 
because repository.xml use it as a reference. Please look. My userdefined 
repository_user.xml looks like following (complete file! is included at the 
end);

And now I want to run my app: I get these messages:
Hello OJB!
Exception in thread "main" java.lang.ExceptionInInitializerError
        at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Unknown 
Source)
        at 
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(Unknown 
Source)
        at 
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown 
Source)
        at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not read 
repository class descriptor data, using repository: repository.xml
        at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown Source)
        at org.apache.ojb.broker.metadata.MetadataManager.<init>(Unknown 
Source)
        at org.apache.ojb.broker.metadata.MetadataManager.<clinit>(Unknown 
Source)
        ... 4 more
Caused by: org.apache.ojb.broker.metadata.MetadataException: Exception when 
reading metadata information, please check your repository.xml file
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
        at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readMetadataFromXML(Unknown 
Source)
        at 
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Unknown 
Source)
        at 
org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorRepository(Unknown 
Source)
        ... 7 more

I'm out of order! ;-) Do you have any further ideas???

File repository_user.xml:
<class-descriptor class="jegmont.Attachments" table="ATTACHMENTS">
                <field-descriptor name="attachID" primarykey="true" 
default-fetch="true" column="ATTACHID" jdbc-type="INTEGER"/>
                <field-descriptor name="filename" nullable="false" 
default-fetch="true" column="FILENAME" jdbc-type="VARCHAR"/>
                <field-descriptor name="attachment" nullable="false" 
default-fetch="true" column="ATTACHMENT" jdbc-type="BLOB"/>
                <collection-descriptor
                        name="emailID"
                        element-class-ref="jegmont.Emails"
                        orderby="emailID"
                        sort="DESC"
                 >
                        <inverse-foreignkey field-ref="emailId"/>
                 </collection-descriptor>
        </class-descriptor>
        <class-descriptor class="jegmont.Emails" table="EMAILS">
                <field-descriptor name="emailID" primarykey="true" 
default-fetch="true" column="EMAILID" jdbc-type="BIGINT"/>
                <field-descriptor name="boxID" nullable="false" 
default-fetch="true" column="BOXID" jdbc-type="INTEGER"/>
                <field-descriptor name="status" nullable="false" 
default-fetch="true" column="STATUS" jdbc-type="CHAR"/>
                <field-descriptor name="subject" nullable="false" 
default-fetch="true" column="SUBJECT" jdbc-type="VARCHAR"/>
                <field-descriptor name="mailFrom" nullable="false" 
default-fetch="true" column="MAILFROM" jdbc-type="VARCHAR"/>
                <field-descriptor name="mailTo" nullable="false" 
default-fetch="true" column="MAILTO" jdbc-type="VARCHAR"/>
                <field-descriptor name="replyTo" nullable="false" 
default-fetch="true" column="REPLYTO" jdbc-type="VARCHAR"/>
                <field-descriptor name="time" nullable="false" 
default-fetch="true" column="TIME" jdbc-type="TIMESTAMP" 
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion"/>
                <field-descriptor name="msgBody" nullable="false" 
default-fetch="true" column="MSGBODY" jdbc-type="LONGVARCHAR"/>
        </class-descriptor>
        <class-descriptor class="jegmont.OfficeBoxes" table="OFFICEBOXES">
                <field-descriptor name="boxID" primarykey="true" 
default-fetch="true" column="BOXID" jdbc-type="INTEGER"/>
                <field-descriptor name="userID" nullable="false" 
default-fetch="true" column="USERID" jdbc-type="TINYINT"/>
                <field-descriptor name="boxName" nullable="false" 
default-fetch="true" column="BOXNAME" jdbc-type="VARCHAR"/>
                <field-descriptor name="comment" nullable="false" 
default-fetch="true" column="COMMENT" jdbc-type="TINYTEXT"/>
                <field-descriptor name="action" nullable="false" 
default-fetch="true" column="ACTION" jdbc-type="BLOB"/>
        </class-descriptor>
        <class-descriptor class="jegmont.POPAddresses" table="POPADDRESSES">
                <field-descriptor name="popID" primarykey="true" 
default-fetch="true" column="POPID" jdbc-type="INTEGER"/>
                <field-descriptor name="popAddresses" nullable="false" 
default-fetch="true" column="POPADDRESSES" jdbc-type="VARCHAR"/>
                <field-descriptor name="boxID" nullable="false" 
default-fetch="true" column="BOXID" jdbc-type="TINYINT"/>
                <field-descriptor name="login" nullable="false" 
default-fetch="true" column="LOGIN" jdbc-type="VARCHAR"/>
                <field-descriptor name="password" nullable="false" 
default-fetch="true" column="PASSWORD" jdbc-type="VARCHAR"/>
                <field-descriptor name="serverID" nullable="false" 
default-fetch="true" column="SERVERID" jdbc-type="INTEGER"/>
        </class-descriptor>
        <class-descriptor class="jegmont.POPServers" table="POPSERVERS">
                <field-descriptor name="serverID" primarykey="true" 
default-fetch="true" column="SERVERID" jdbc-type="INTEGER"/>
                <field-descriptor name="host" nullable="false" 
default-fetch="true" column="HOST" jdbc-type="VARCHAR"/>
                <field-descriptor name="port" nullable="false" 
default-fetch="true" column="PORT" jdbc-type="TINYINT"/>
        </class-descriptor>
        <class-descriptor class="jegmont.Settings" table="SETTINGS">
<class-descriptor class="jegmont.Settings" table="SETTINGS">
                <field-descriptor name="settingID" primarykey="true" 
default-fetch="true" column="SETTINGID" jdbc-type="INTEGER"/>
                <field-descriptor name="userID" nullable="false" 
default-fetch="true" column="USERID" jdbc-type="INTEGER"/>
                <field-descriptor name="signature" nullable="false" 
default-fetch="true" column="SIGNATURE" jdbc-type="VARCHAR"/>
                <field-descriptor name="smtp" nullable="false" 
default-fetch="true" column="SMTP" jdbc-type="VARCHAR"/>
                <field-descriptor name="port" nullable="false" 
default-fetch="true" column="PORT" jdbc-type="TINYINT"/>
        </class-descriptor>
        <class-descriptor class="jegmont.Users" table="USERS">
                <field-descriptor name="userID" primarykey="true" 
default-fetch="true" column="USERID" jdbc-type="INTEGER"/>
                <field-descriptor name="name" nullable="false" 
default-fetch="true" column="NAME" jdbc-type="VARCHAR"/>
                <field-descriptor name="surname" nullable="false" 
default-fetch="true" column="SURNAME" jdbc-type="VARCHAR"/>
                <field-descriptor name="login" nullable="false" 
default-fetch="true" column="LOGIN" jdbc-type="VARCHAR"/>
                <field-descriptor name="password" nullable="false" 
default-fetch="true" column="PASSWORD" jdbc-type="VARCHAR"/>
</class-descriptor>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OK Last Question for Today!

Posted by Armin Waibel <ar...@apache.org>.
If all declared xml-reference files are in the same directory as the 
repository.xml file, OJB will start reading metadata.
If something wrong with your metadata definitions, please enable debug 
logging level for
org.apache.ojb.broker.metadata.RepositoryXmlHandler
org.apache.ojb.broker.metadata.ConnectionDescriptorXmlHandler
in properties file of your log-api. If you use OJB default, you can set 
this in OJB.properties file. Then you can see when the exception occur 
while reading.

regards,
Armin

Sven Alisch wrote:

> Dear Armin,
> 
> The last question was stupid maybe, ok - i found the original 
> repository.xml-file with all references. Now really, everything is in my 
> classpath. My userdefined mapping i place into the repository_user.xml, 
> because repository.xml use it as a reference. Please look. My userdefined 
> repository_user.xml looks like following (complete file! is included at the 
> end);
> 
> And now I want to run my app: I get these messages:
> Hello OJB!
> Exception in thread "main" java.lang.ExceptionInInitializerError
>         at 
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Unknown 
> Source)
>         at 
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(Unknown 
> Source)
>         at 
> org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown 
> Source)
>         at JEgmont.main(Unknown Source)
> Caused by: org.apache.ojb.broker.metadata.MetadataException: Can not read 
> repository class descriptor data, using repository: repository.xml
>         at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown Source)
>         at org.apache.ojb.broker.metadata.MetadataManager.<init>(Unknown 
> Source)
>         at org.apache.ojb.broker.metadata.MetadataManager.<clinit>(Unknown 
> Source)
>         ... 4 more
> Caused by: org.apache.ojb.broker.metadata.MetadataException: Exception when 
> reading metadata information, please check your repository.xml file
>         at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658)
>         at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
>         at 
> org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
>         at 
> org.apache.ojb.broker.metadata.RepositoryPersistor.readMetadataFromXML(Unknown 
> Source)
>         at 
> org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Unknown 
> Source)
>         at 
> org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorRepository(Unknown 
> Source)
>         ... 7 more
> 
> I'm out of order! ;-) Do you have any further ideas???
> 
> File repository_user.xml:
> <class-descriptor class="jegmont.Attachments" table="ATTACHMENTS">
>                 <field-descriptor name="attachID" primarykey="true" 
> default-fetch="true" column="ATTACHID" jdbc-type="INTEGER"/>
>                 <field-descriptor name="filename" nullable="false" 
> default-fetch="true" column="FILENAME" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="attachment" nullable="false" 
> default-fetch="true" column="ATTACHMENT" jdbc-type="BLOB"/>
>                 <collection-descriptor
>                         name="emailID"
>                         element-class-ref="jegmont.Emails"
>                         orderby="emailID"
>                         sort="DESC"
>                  >
>                         <inverse-foreignkey field-ref="emailId"/>
>                  </collection-descriptor>
>         </class-descriptor>
>         <class-descriptor class="jegmont.Emails" table="EMAILS">
>                 <field-descriptor name="emailID" primarykey="true" 
> default-fetch="true" column="EMAILID" jdbc-type="BIGINT"/>
>                 <field-descriptor name="boxID" nullable="false" 
> default-fetch="true" column="BOXID" jdbc-type="INTEGER"/>
>                 <field-descriptor name="status" nullable="false" 
> default-fetch="true" column="STATUS" jdbc-type="CHAR"/>
>                 <field-descriptor name="subject" nullable="false" 
> default-fetch="true" column="SUBJECT" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="mailFrom" nullable="false" 
> default-fetch="true" column="MAILFROM" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="mailTo" nullable="false" 
> default-fetch="true" column="MAILTO" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="replyTo" nullable="false" 
> default-fetch="true" column="REPLYTO" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="time" nullable="false" 
> default-fetch="true" column="TIME" jdbc-type="TIMESTAMP" 
> conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion"/>
>                 <field-descriptor name="msgBody" nullable="false" 
> default-fetch="true" column="MSGBODY" jdbc-type="LONGVARCHAR"/>
>         </class-descriptor>
>         <class-descriptor class="jegmont.OfficeBoxes" table="OFFICEBOXES">
>                 <field-descriptor name="boxID" primarykey="true" 
> default-fetch="true" column="BOXID" jdbc-type="INTEGER"/>
>                 <field-descriptor name="userID" nullable="false" 
> default-fetch="true" column="USERID" jdbc-type="TINYINT"/>
>                 <field-descriptor name="boxName" nullable="false" 
> default-fetch="true" column="BOXNAME" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="comment" nullable="false" 
> default-fetch="true" column="COMMENT" jdbc-type="TINYTEXT"/>
>                 <field-descriptor name="action" nullable="false" 
> default-fetch="true" column="ACTION" jdbc-type="BLOB"/>
>         </class-descriptor>
>         <class-descriptor class="jegmont.POPAddresses" table="POPADDRESSES">
>                 <field-descriptor name="popID" primarykey="true" 
> default-fetch="true" column="POPID" jdbc-type="INTEGER"/>
>                 <field-descriptor name="popAddresses" nullable="false" 
> default-fetch="true" column="POPADDRESSES" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="boxID" nullable="false" 
> default-fetch="true" column="BOXID" jdbc-type="TINYINT"/>
>                 <field-descriptor name="login" nullable="false" 
> default-fetch="true" column="LOGIN" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="password" nullable="false" 
> default-fetch="true" column="PASSWORD" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="serverID" nullable="false" 
> default-fetch="true" column="SERVERID" jdbc-type="INTEGER"/>
>         </class-descriptor>
>         <class-descriptor class="jegmont.POPServers" table="POPSERVERS">
>                 <field-descriptor name="serverID" primarykey="true" 
> default-fetch="true" column="SERVERID" jdbc-type="INTEGER"/>
>                 <field-descriptor name="host" nullable="false" 
> default-fetch="true" column="HOST" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="port" nullable="false" 
> default-fetch="true" column="PORT" jdbc-type="TINYINT"/>
>         </class-descriptor>
>         <class-descriptor class="jegmont.Settings" table="SETTINGS">
> <class-descriptor class="jegmont.Settings" table="SETTINGS">
>                 <field-descriptor name="settingID" primarykey="true" 
> default-fetch="true" column="SETTINGID" jdbc-type="INTEGER"/>
>                 <field-descriptor name="userID" nullable="false" 
> default-fetch="true" column="USERID" jdbc-type="INTEGER"/>
>                 <field-descriptor name="signature" nullable="false" 
> default-fetch="true" column="SIGNATURE" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="smtp" nullable="false" 
> default-fetch="true" column="SMTP" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="port" nullable="false" 
> default-fetch="true" column="PORT" jdbc-type="TINYINT"/>
>         </class-descriptor>
>         <class-descriptor class="jegmont.Users" table="USERS">
>                 <field-descriptor name="userID" primarykey="true" 
> default-fetch="true" column="USERID" jdbc-type="INTEGER"/>
>                 <field-descriptor name="name" nullable="false" 
> default-fetch="true" column="NAME" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="surname" nullable="false" 
> default-fetch="true" column="SURNAME" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="login" nullable="false" 
> default-fetch="true" column="LOGIN" jdbc-type="VARCHAR"/>
>                 <field-descriptor name="password" nullable="false" 
> default-fetch="true" column="PASSWORD" jdbc-type="VARCHAR"/>
> </class-descriptor>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org