背景是这样子,项目环境spring2.5.6,jdk1.7,项目部署在weblogic12上,但是公司内网扫描出来weblogic12有漏洞,因此要升级为weblogic14,相应的jdk升级为1.8,spring版本升级为4.3.16,本地开发使用的是tomcat8.0,可以正常启动,打包部署到服务器上(weblogic14)时报错如下:
DispatcherServlet: Context initialization failed
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'wsrmSafRegistrationService': Unsatisfied dependency expressed through field 'safServerService';
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'weblogic.messaging.saf.internal.SAFServerService' available:
expected at least 1 bean which qualifies as autowire candidate.
Dependency annotations: {@javax.inject.Inject(), @javax.inject.Named(value=SAFServerService)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1493)
上面这位大佬「东方神龙马」曾碰到过类似问题:部署应用报错Error creating bean with name 'wsrmSafRegistrationService',之后在日志中可看到 Spring在初始化Bean,wsrmSafRegistrationService,但其实其全类名为: com.oracle.webservices.impl.wls.wsrmSafRegistrationService其内部使用了 ,@Inject @Named("SAFServerService"),private SAFServerService safServerService;因此是Spring做Autowire自动链接的时候,扫描到了WebLogic内部的类,这部分扫描不应该发生,因此要在代码中加Spring Autowire的过滤器,避免扫描到WebLogic内部的类。
请问如何在代码中加Spring Autowire的过滤器以避免扫描到WebLogic内部的类?
在xml配置文件增加了如下内容,发现并不能生效,依然报错!
请指正,不胜感激!
参考链接:https://blog.csdn.net/m0_38119087/article/details/121145537
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
其实就是你的spring包冲突了,本地跑确实没问题,但是打包部署他找到了2个spring.jar包,所以不知道选择哪一个,所以报错。
你也说了你升级了版本,那么旧的版本要移除掉才行。