the type org.apache.log4j.Category Cannot be resolved,it is indirectly reference

cswhgloveu 2014-07-08 11:20:42
the type org.apache.log4j.Category Cannot be resolved,it is indirectly referenced from required .class files

以上错误信息咋个处理? 请求指教

具体代码

package sys.test;

import java.util.*;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import sy.model.User;
import sy.service.UserServiceI;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring.xml","classpath:spring-mybatis.xml"})
public class TestMyBatisSpring {
//private ApplicationContext ac ;
private static final Logger logger = Logger.getLogger(TestMyBatisSpring.class) ; //Logger.getLogger(TestMyBatisSpring.class);
private UserServiceI userService;

public UserServiceI getUserService() {
return userService;
}
@Autowired //将 userService 自动注入。这块还得好好理解啊
public void setUserService(UserServiceI userService) {
this.userService = userService;
}
...全文
522 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cswhgloveu 2014-07-12
  • 打赏
  • 举报
回复
cswhgloveu 2014-07-08
  • 打赏
  • 举报
回复
那个我都查过了,也做了,还是不行的。好像写的不对了啥的。。看了这段,我也不晓得咋处理。。。 public class Categoryextends Objectimplements AppenderAttachableThis class has been deprecated and replaced by the Logger subclass. It will be kept around to preserve backward compatibility until mid 2003. Logger is a subclass of Category, i.e. it extends Category. In other words, a logger is a category. Thus, all operations that can be performed on a category can be performed on a logger. Internally, whenever log4j is asked to produce a Category object, it will instead produce a Logger object. Log4j 1.2 will never produce Category objects but only Logger instances. In order to preserve backward compatibility, methods that previously accepted category objects still continue to accept category objects. For example, the following are all legal and will work as expected. // Deprecated form: Category cat = Category.getInstance("foo.bar") // Preferred form for retrieving loggers: Logger logger = Logger.getLogger("foo.bar")
tony4geek 2014-07-08
  • 打赏
  • 举报
回复

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧