Results 1 to 3 of 3
  1. #1
    rajeev is offline Member
    Join Date
    Jul 2013
    Location
    india
    Posts
    15
    Rep Power
    0

    Post simple spring program showing error........help me

    Hello.java
    -----------

    package com.nareshit.spring;

    public interface Hello{
    String sayHello();
    }

    hello.xml
    ----------

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <beans>
    <bean id="helloBean"
    class = "com.nareshit.spring.HelloBean"/>
    <constructor-arg>
    <value>Hello World</value>
    </constructor-arg>
    </bean>
    </beans>

    HelloBean.java
    ---------------

    package com.nareshit.spring;

    import com.nareshit.spring.Hello;

    public class HelloBean implements Hello{
    private String message;

    public HelloBean(String message){
    this.message=message;
    System.out.println("parameterized constructor");
    }

    public String sayHello(){
    System.out.println("say hello called");
    return message;
    }
    }

    HelloClient.java
    ------------------


    import com.nareshit.spring.HelloBean;
    import org.springframework.beans.factory.*;
    import org.springframework.beans.factory.xml.*;
    import org.springframework.core.io.*;
    public class HelloClient
    {
    public static void main(String[] args)
    {
    BeanFactory factory=new XmlBeanFactory(new ClassPathResource("hello.xml"));
    HelloBean bean=factory.getBean("helloBean",HelloBean.class);
    System.out.println(bean.sayHello());
    }
    }


    ================================================== =====
    i added org.springframework.beans-sources-3.0.5.RELEASE.jar , org.springframework.core-sources-3.0.5.RELEASE.jar and commons-logging.jar file to classpath. i am using jdk 1.6 version.
    the above Hello.java and HelloBean.java compiled successfully but i got following error while compiling HelloClient.java .i dont know why...


    E:\javahyd\ramesh\spring\editplus\1st>javac HelloClient.java
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/DefaultListableBeanFactory.java):39: package javax.inject does not exist
    import javax.inject.Provider;
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/DefaultListableBeanFactory.java):1022: cannot find symbol
    symbol : class Provider
    location: class org.springframework.beans.factory.support.DefaultL istableBeanFactory
    private class DependencyProvider extends DependencyObjectFactory implements Provider {
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):22: package net.sf.cglib.proxy does not exist
    import net.sf.cglib.proxy.Callback;
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):23: package net.sf.cglib.proxy does not exist
    import net.sf.cglib.proxy.CallbackFilter;
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):24: package net.sf.cglib.proxy does not exist
    import net.sf.cglib.proxy.Enhancer;
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):25: package net.sf.cglib.proxy does not exist
    import net.sf.cglib.proxy.MethodInterceptor;
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):26: package net.sf.cglib.proxy does not exist
    import net.sf.cglib.proxy.MethodProxy;
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):27: package net.sf.cglib.proxy does not exist
    import net.sf.cglib.proxy.NoOp;
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):155: cannot find symbol
    symbol : class MethodInterceptor
    location: class org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.CglibSubclassCreator
    private class LookupOverrideMethodInterceptor extends CglibIdentitySupport implements MethodInterceptor {
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):157: cannot find symbol
    symbol : class MethodProxy
    location: class org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.CglibSubclassCreator .LookupOverrideMethodInterceptor
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable {
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):169: cannot find symbol
    symbol : class MethodInterceptor
    location: class org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.CglibSubclassCreator
    private class ReplaceOverrideMethodInterceptor extends CglibIdentitySupport implements MethodInterceptor {
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):171: cannot find symbol
    symbol : class MethodProxy
    location: class org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.CglibSubclassCreator .ReplaceOverrideMethodInterceptor
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable {
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):183: cannot find symbol
    symbol : class CallbackFilter
    location: class org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.CglibSubclassCreator
    private class CallbackFilterImpl extends CglibIdentitySupport implements CallbackFilter {
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):109: cannot find symbol
    symbol : class Enhancer
    location: class org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.CglibSubclassCreator
    Enhancer enhancer = new Enhancer();
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):109: cannot find symbol
    symbol : class Enhancer
    location: class org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.CglibSubclassCreator
    Enhancer enhancer = new Enhancer();
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):112: cannot find symbol
    symbol : class Callback
    location: class org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.CglibSubclassCreator
    enhancer.setCallbacks(new Callback[] {
    ^
    E:\spring-framework-3.0.5.RELEASE\src\org.springframework.beans-sources-3.0.5.RELEASE.jar(org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java):113: cannot find symbol
    symbol : variable NoOp
    location: class org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.CglibSubclassCreator
    NoOp.INSTANCE,
    ^
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    17 errors

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: simple spring program showing error........help me

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: simple spring program showing error........help me

    Um, have you only downloaded the source jar?
    You need the compiled jar file...
    What you're seeing there looks to me like the java compiler is trying to compile the spring code.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Simple jdbc wrapper showing query timings on a web page
    By rnentjes in forum Reviews / Advertising
    Replies: 1
    Last Post: 06-21-2012, 05:43 AM
  2. Replies: 5
    Last Post: 12-04-2010, 12:30 AM
  3. showing error in the pop
    By arun9683 in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 07-02-2010, 10:53 AM
  4. ClassNotFoundException in a simple spring application
    By adammyth in forum Web Frameworks
    Replies: 0
    Last Post: 03-17-2010, 12:21 PM
  5. Replies: 6
    Last Post: 02-24-2009, 02:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •