The type org.springframework.beans.BeansException cannot be resolved. It is indirectly referenced fr

85 篇文章 0 订阅

Hi am facing issue with below error in eclipse please help to resolve this issue.

Error message

The type org.springframework.beans.BeansException cannot be resolved. It is indirectly referenced from required .class files

I imported the jar file (org.springframework.context-3.0.4.RELEASE) even then am facing this issue.

see below code( where am getting issue at line ApplicationContext appCtx = new ClassPathXmlApplicationContext("applicationContext.xml");)

    package com.csp.test.document;

    import static org.junit.Assert.*;
    import org.junit.Test;
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;

    import com.csp.model.Document;
    import com.csp.service.DocumentService;

    public class DocumentTest {

        @Test
        public void testGetDocument() {
            ApplicationContext appCtx = new ClassPathXmlApplicationContext(
                    "applicationContext.xml");

            DocumentService documentService = (DocumentService) appCtx
                    .getBean("documentService");

            Document doc = documentService.getDocument(1);

            String status = null;

            if (doc != null) {
                status = documentService.saveDocument(doc);
            } else {
                System.out.println("error in retreiving document");
            }

            assertEquals("Success Status", "SUCCESS", status);

        }

    }
share improve this question
 

2 Answers

up vote 4 down vote accepted

If you aren't using maven (or any other dependency management tool, for that matter), you should addspring-context dependencies manually, which are spring-beansspring-corespring-aop and spring-expression, of course each of them have their own dependencies either (Transitive Dependency). By the way, BeansException is part of spring-beans module

share improve this answer
 
1 
Thank you :) as you said I have download (spring-beans-3.1.xsd download) jar and its worked for me...... –  ela0250  Dec 11 '14 at 15:18
 
Your welocome. for better dependency management, i recommend to use maven –  Ali Dehghani  Dec 11 '14 at 15:35

May be you are missing org.springframework.beans-3.0.4.RELEASE jar

share improve this answer
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值