What Is Spring, Part 1
Subject:   Problem in Running the code
Date:   2006-07-23 17:18:11
From:   cptanalatriste
Response to: Problem in Running the code

Having the same problem...Help please!!

Carlos Gavidia

Full Threads Newest First

Showing messages 1 through 1 of 1.

  • Problem in Running the code
    2009-02-16 23:54:23  arunk3 [View]

    Don know what the exact problem was in the code, maybe coz i am using Spring 2.5.6
    Anyways, to make the code runnable,

    1) change as below

    public class RentABikeAssembler {
    public static final void main(String[] args) {
    FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
    CommandLineView clv = (CommandLineView) ctx.getBean("commandLineView");

    Replace the file path to where your RentABike-context.xml is.

    2) In, provide getters and setters for storeName, as below.
    public String getStoreName() {
    return storeName;

    public void setStoreName(String storeName) {
    this.storeName = storeName;

    3) if you used packages while creating the classes, then inside RentABike-context.xml, replace the Class names by fully qualified names Ex,
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">
    <bean id="rentaBike" class="com.persistent.brs1.ArrayListRentABike">
    <property name="storeName">
    <value>"Bruce's Bikes"</value>
    <bean id="commandLineView" class="com.persistent.brs1.CommandLineView">
    <property name="rentaBike">
    <ref bean="rentaBike" />