Announcement Announcement Module
Collapse
No announcement yet.
Help on OJB Configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help on OJB Configuration

    Hi everyone,

    We have been developing an application based on Struts-Spring-Hibernate combination and have been successful in integrating the 3 technologies. However, we have requirements on supporting OJB as well. So far I've been getting this error during runtime:

    java.lang.NullPointerException
    at org.apache.ojb.broker.util.BrokerHelper.crossCheck PBKey(BrokerHelper.java:123)
    at org.apache.ojb.broker.core.PersistenceBrokerFactor yDefaultImpl.createPersistenceBroker(PersistenceBr okerFactoryDefaultImpl.java:92)
    at org.apache.ojb.broker.PersistenceBrokerFactory.cre atePersistenceBroker(PersistenceBrokerFactory.java :86)
    at org.springframework.orm.ojb.OjbFactoryUtils.getPer sistenceBroker(OjbFactoryUtils.java:89)
    at org.springframework.orm.ojb.PersistenceBrokerTrans actionManager.getPersistenceBroker(PersistenceBrok erTransactionManager.java:146)
    at org.springframework.orm.ojb.PersistenceBrokerTrans actionManager.doBegin(PersistenceBrokerTransaction Manager.java:179)
    at org.springframework.transaction.support.AbstractPl atformTransactionManager.getTransaction(AbstractPl atformTransactionManager.java:269)
    at org.springframework.transaction.interceptor.Transa ctionAspectSupport.createTransactionIfNecessary(Tr ansactionAspectSupport.java:200)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:49)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :138)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:152)
    at $Proxy0.getUser(Unknown Source)
    at com.exist.agileapp.crm.login.LoginAction.execute(L oginAction.java:61)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)



    Here are the excerpts of the applicationContext-ojb.xml:



    <bean id="crmDataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName"><value>${jdbc.driverClassNa me}</value></property>
    <property name="url"><value>${jdbc.url}</value></property>
    <property name="username"><value>${jdbc.username}</value></property>
    <property name="password"><value>${jdbc.password}</value></property>
    </bean>

    ----

    <bean id="ojbConfigurer" class="org.springframework.orm.ojb.support.LocalOj bConfigurer"/>


    ----

    <bean id="crmTransactionManager" class="org.springframework.orm.ojb.PersistenceBrok erTransactionManager"/>

    ----

    <bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean"
    abstract="true">
    <property name="transactionManager"><ref bean="crmTransactionManager"/></property>
    <property name="transactionAttributes">
    <props>
    <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    <prop key="add*">PROPAGATION_REQUIRED</prop>
    <prop key="update*">PROPAGATION_REQUIRED</prop>
    <prop key="delete*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>

    -----

    <bean id="userService" parent="baseTransactionProxy">
    <property name="target">
    <bean class="com.exist.agileapp.crm.service.spring.UserS erviceSpringImpl">
    <property name="userDao"><ref local="userDao"/></property>
    </bean>
    </property>
    </bean>

    -----

    <bean id="userDao" class="com.exist.agileapp.crm.bo.dao.ojb.UserDaoOJ BImpl" />

    I am fairly new with OJB as well, so it might be that I have missed out on some configurations. All the required files by OJB are present. I've set
    ConnectionFactoryClass=org.springframework.orm.ojb .support.LocalDataSourceConnectionFactory in my OJB.properties file.

    Any help very much appreciated!

    Mike

  • #2
    I eventually found the problem. My repository-database.xml was not configured properly to point to my datasource. :roll:

    Comment

    Working...
    X