您的位置:首页 > 编程语言 > Java开发

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

2015-10-17 11:01 2291 查看


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






up
vote1down
votefavorite

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);

}

}


java javascript eclipse spring swing
shareimprove
this question
asked Dec 11 '14 at 14:43





ela0250
337

 add
a comment


2 Answers

activeoldestvotes

up vote4down
voteaccepted
If you aren't using maven (or any other dependency management tool, for that matter), you should add
spring-context
 dependencies
manually, which are 
spring-beans
spring-core
spring-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

shareimprove
this answer
edited Dec
11 '14 at 15:09

answered Dec 11 '14 at 15:02





Ali Dehghani
72845

 
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
add
a comment





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

shareimprove
this answer
answered Dec 11 '14 at 15:01





kyzh101
168

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: