Okay, finally got a chance to start working more with OJB (started to a
month ago and then things got bonkers =/) and I am having a big problem
getting the PeristenceBroker working.

Here is the situation:

When I run a very basic test (just trying to get a Broker!) I hit the
following error:

[BOOT] ERROR: The specified class
"org.apache.ojb.broker.util.sequence.SequenceManagerHiLoImpl" does not
implement the interface
org.apache.ojb.broker.util.sequence.SequenceManager, which is a
requirement for the key "SequenceManagerClass". Using default class
org.apache.ojb.broker.util.sequence.SequenceManagerHiLoImpl
[BOOT] ERROR: The specified class
"org.apache.ojb.broker.cache.ObjectCacheDefaultImpl" does not implement
the interface org.apache.ojb.broker.cache.ObjectCache, which is a
requirement for the key "ObjectCacheClass". Using default class
org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
[BOOT] ERROR: The specified class
"org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl" does not
implement the interface
org.apache.ojb.broker.accesslayer.ConnectionFactory, which is a
requirement for the key "ConnectionFactoryClass". Using default class
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
[BOOT] ERROR: The specified class
"org.apache.ojb.odmg.locking.LockManagerDefaultImpl" does not implement
the interface org.apache.ojb.odmg.locking.LockManager, which is a
requirement for the key "LockManagerClass". Using default class
org.apache.ojb.odmg.locking.LockManagerDefaultImpl
[BOOT] ERROR: The specified class
"org.apache.ojb.odmg.locking.InMemoryLockMapImpl" does not implement the
interface org.apache.ojb.odmg.locking.LockMap, which is a requirement
for the key "LockMapClass". Using default class
org.apache.ojb.odmg.locking.PersistentLockMapImpl
[BOOT] ERROR: The specified class
"org.apache.ojb.broker.util.logging.PoorMansLoggerImpl" does not
implement the interface org.apache.ojb.broker.util.logging.Logger, which
is a requirement for the key "LoggerClass". Using default class
org.apache.ojb.broker.util.logging.PoorMansLoggerImpl
[BOOT] ERROR: The specified class
"org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl"
does not implement the interface
org.apache.ojb.broker.metadata.fieldaccess.PersistentField, which is a
requirement for the key "PersistentFieldClass". Using default class
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl
[BOOT] ERROR: The specified class
"org.apache.ojb.broker.singlevm.PersistenceBrokerImpl" does not
implement the interface org.apache.ojb.broker.PersistenceBroker, which
is a requirement for the key "PersistenceBrokerClass". Using default
class org.apache.ojb.broker.singlevm.PersistenceBrokerImpl
[BOOT] ERROR: The specified class
"org.apache.ojb.odmg.collections.DListImpl" does not implement the
interface org.apache.ojb.broker.ManageableCollection, which is a
requirement for the key "OqlCollectionClass". Using default class
org.apache.ojb.odmg.collections.DListImpl
[org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] INFO:
Create PersistenceBroker instance pool, pool configuration was
{whenExhaustedAction=0, maxIdle=-1, maxActive=100, maxWait=2000,
numTestsPerEvictionRun=10, testWhileIdle=false, testOnReturn=false,
timeBetweenEvictionRunsMillis=-1, minEvictableIdleIimeMillis=600000,
testOnBorrow=false}
[org.apache.ojb.broker.ta.PersistenceBrokerFactoryFactory] ERROR: Error
in instantiation of PersistenceBrokerFactory class
null
java.lang.ClassCastException
        at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryFactory.instantiate(Unknown Source)
        at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryFactory.instance(Unknown Source)
        at
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Unknown Source)
        at
org.skife.registry.domain.TestUser.testGetPersistenceBroker(TestUser.java:18)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.swingui.TestRunner$16.run(TestRunner.java:623)
[org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] INFO:
Create PersistenceBroker instance pool, pool configuration was
{whenExhaustedAction=0, maxIdle=-1, maxActive=100, maxWait=2000,
numTestsPerEvictionRun=10, testWhileIdle=false, testOnReturn=false,
timeBetweenEvictionRunsMillis=-1, minEvictableIdleIimeMillis=600000,
testOnBorrow=false}
Process terminated with exit code 0

I am running against PostgreSQL 7.2.2 with the JDBC 2.0 driver 

Current configuration and test class:

Test Class:
<code>
package org.skife.registry.domain;

import junit.framework.TestCase;
import junit.framework.Assert;
import org.apache.ojb.broker.PersistenceBrokerFactory;
import org.apache.ojb.broker.PersistenceBroker;

public class TestUser extends TestCase
{
    public TestUser(String name)
    {
        super(name);
    }

    public void testGetPersistenceBroker()
    {
        PersistenceBroker broker = null;
        broker =
PersistenceBrokerFactory.createPersistenceBroker("repository.xml",
"registryadmin", "nopassword");
        Assert.assertNotNull(broker);
    }
}
</code>


I am using the default OJB.properties.

Here is repository.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a sample metadata repository for the ObJectBridge System.
     Use this file as a template for building your own mappings-->

<!-- defining entities for include-files -->
<!DOCTYPE descriptor-repository SYSTEM "repository.dtd" [
<!ENTITY user SYSTEM "repository_user.xml">
<!-- <!ENTITY junit SYSTEM "repository_junit.xml"> -->
<!ENTITY internal SYSTEM "repository_internal.xml">
<!-- <!ENTITY farAway SYSTEM "repositoryFarAway_user.xml"> -->
]>


<descriptor-repository version="0.9.8"
isolation-level="read-uncommitted">
<!-- The Default JDBC Connection. If a class-descriptor does not specify
its own JDBC Connection,
     the Connection specified here will be used. -->

   <jdbc-connection-descriptor
                platform="PostgreSQL"
                jdbc-level="2.0"
                driver="org.postgresql.Driver"
                protocol="jdbc"
                subprotocol="postgres"
                dbalias="registry"
                username="registryadmin"
                password="nopassword"
   />

    <!-- include user defined mappings here -->
    &user;

    <!-- include mappings for JUnit tests here -->
   <!--  &junit; -->

    <!-- include ojb internal mappings here -->
    &internal;

        <!-- user data of farAway db -->
    <!-- &farAway; -->

</descriptor-repository>

and repository_user.xml...

<class-descriptor
    class="org.skife.registry.domain.User"
    table="USER"
    >
    <field-descriptor id="1"
        name="handle"
        column="HANDLE"
        jdbc-type="VARCHAR"
        primarykey="true"
        />
    <field-descriptor id="2"
        name="name"
        column="NAME"
        jdbc-type="VARCHAR"
        />
    <field-descriptor id="3"
        name="password"
        column="PASSWORD"
        jdbc-type="VARCHAR"
        />
    <field-descriptor id="4" name="userId" column="userid"
jdbc-type="Integer"  />
</class-descriptor>


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

Reply via email to