Wrox Programmer Forums
|
BOOK: Professional Java Development with the Spring Framework
This is the forum to discuss the Wrox book Professional Java Development with the Spring Framework by Rod Johnson, Juergen Hoeller, Alef Arendsen, Thomas Risberg, Colin Sampaleanu; ISBN: 9780764574832
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Java Development with the Spring Framework section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2005, 09:17 PM
Registered User
 
Join Date: Oct 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Spring-ojb

I tried for Springframework to interact with Oracle9i using apache's ojb throw spring beans.
 i had given OJB-repository.xml as
<descriptor-repository version="1.0">
 <jdbc-connection-descriptor
   jcd-alias="oraSource" default-connection="true"
   platform="Oracle9i" jdbc-level="3.0" useAutoCommit="1" username="scott" password="tiger">
    <object-cache
class="org.apache.ojb.broker.cache.ObjectCachePerB rokerImpl">
    </object-cache>
    <connection-pool maxActive="10" maxIdle="2" maxWait="3"
validationQuery=""
     logAbandoned="true" removeAbandoned="true" removeAbandonedTimeout="8"/>
    </jdbc-connection-descriptor>

   <class-descriptor class="com.htc.springdemos.ojbs.StudentVO" table="STUDENTS">
      <field-descriptor name="stuId" column="STU_ID" primarykey="true" autoincrement="true"/>
  <field-descriptor name="stuName" column="STU_NAME" />
  <field-descriptor name="course" column="COURSE" />
        </class-descriptor>
</descriptor-repository>

in the ojb.properties i had given
ConnectionFactoryClass=org.springframework.orm.ojb .support.TransactionAwareDataSourceConnectionFacto ry as the only change

in beans.xml file (ojb1.xml)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="ojbConfigurer" class="org.springframework.orm.ojb.support.LocalOj bConfigurer" />
  <bean id="oraSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
   <property name="driverClassName">
    <value>oracle.jdbc.driver.OracleDriver</value>
   </property>
      <property name="url"> <value>jdbc:oracle:thin:@localhost:1521:oracle10 </value>
   </property>
   <property name="username">
    <value>scott</value>
   </property>
   <property name="password">
    <value>tiger</value>
   </property>
  </bean>

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

 <bean id="studentDao" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
   <property name="transactionManager">
    <ref bean="transactionManager" />
   </property>
   <property name="target">
    <bean class="com.htc.springdemos.ojbs.StudentDAOImpl" />
   </property>
   <property name="transactionAttributes">
    <props>
       <prop key="insert*">
         PROPAGATION_REQUIRED
       </prop>
      <prop key="update*">
         PROPAGATION_REQUIRED
       </prop>
      <prop key="delete*">
         PROPAGATION_REQUIRED
       </prop>
      <prop key="*">
         PROPAGATION_REQUIRED,readOnly
       </prop>
    </props>
   </property>
   </bean>
</beans>


but when i run it is constantly giving only one error

[java] caused by:java.lang.IllegalStateException: No Bean Factory

Configuration-LocalOjbConfigurer must be defined as Spring bean

  please can any one suggest where the mistake is
 my EMAIL is rajendra32@yahoo.co.uk







DTR Prasad





Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning Spring Framework 2 cateyesmale All Other Wrox Books 2 December 7th, 2007 10:03 AM
configuration of spring jadavmanoj Spring 0 July 29th, 2007 06:27 AM
AJAX and Spring GameOne Ajax 1 September 21st, 2006 01:40 AM
Spring Framework tilakkalyan J2EE 1 February 2nd, 2006 06:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.