我有2个这样的Maven项目:


-com.wuntee.rsaAuthenticationManager (jar)

-com.wuntee.taac (pom)
--taac-backend-gui (jar)
--taac-web (war)



并且“ com.wuntee.rsaAuthenticationManager”是“ taac-backend-gui”中的一个部门。在taac-backend-gui中运行测试用例时,一切运行正常,但是当尝试启动taac-web时,我得到以下ClassNotFoundException-包含类'weblogic.security.SSL.TrustManager'的库我的本地Maven存储库,并设置为com.wuntee.rsaAuthenticationManager的依赖项。有谁知道为什么我会收到这个错误?我还尝试将包含TrustManager的库直接添加到taac-web项目,并且仍然得到相同的Exception。有任何想法吗?

ERROR[com.wuntee.taac.business.TaacWorkshop][main] - couldnt create rsa dao:
com.rsa.common.SystemException: Command target (CommandAPIConnection) initialization failure
    java.lang.NoClassDefFoundError: weblogic/security/SSL/TrustManager
    at com.rsa.command.ConnectionFactory.getSpringBeanTarget(ConnectionFactory.java:212)
    at com.rsa.command.ConnectionFactory.getTarget(ConnectionFactory.java:170)
    at com.rsa.command.ConnectionFactory.getConnection(ConnectionFactory.java:246)
    at com.wuntee.rsaAuthenticationManager.RsaAuthenticationManagerDao.init(RsaAuthenticationManagerDao.java:60)
    at com.wuntee.taac.business.TaacWorkshop.<init>(TaacWorkshop.java:68)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:501)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:939)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:892)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:272)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:196)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: com.rsa.ims.components.NoSuchComponentException: Unable to locate bean CommandAPIConnection
    at com.rsa.ims.components.spring.SpringComponentManagerImpl.getBean(SpringComponentManagerImpl.java:71)
    at com.rsa.command.ConnectionFactory.getSpringBeanTarget(ConnectionFactory.java:209)
    ... 39 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CacheableCommandTargetBasicAuth': FactoryBean threw exception on object creation; nested exception is java.lang.reflect.InvocationTargetException
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:150)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1387)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1044)
    at com.rsa.ims.components.spring.SpringComponentManagerImpl.getBean(SpringComponentManagerImpl.java:69)
    ... 40 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:501)
    at com.rsa.command.RemoteCommandTargetFactoryBean.getObject(RemoteCommandTargetFactoryBean.java:273)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:143)
    ... 46 more
Caused by: java.lang.NoClassDefFoundError: weblogic/security/SSL/TrustManager
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at com.rsa.command.InitialContextFactoryLocator.getInitialContextFactory(InitialContextFactoryLocator.java:72)
    at com.rsa.command.EJBRemoteTarget.<init>(EJBRemoteTarget.java:189)
    ... 52 more


在com.wuntee.rsaAuthenticationManager项目中,缺少类的依赖项定义为:

<dependency>
    <groupId>com.rsa</groupId>
    <artifactId>wlfullclient</artifactId>
    <version>1.0</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>


注意:该dep也可以添加到taac-web项目中,但我仍然遇到相同的异常。

我还确认带有该类的.jar位于tomcat Web根目录的WEB-INF / lib /目录中,并且该类确实存在...:

./wlfullclient-1.0.jar
weblogic/security/SSL/TrustManager.class
weblogic/security/SSL/TrustManagerJSSE.class

最佳答案

Maven依赖关系并不总是可传递的。如果taac-backend-gui使用scope="test"optional="true"声明其对com.wuntee.rsaAuthenticationManager的依赖关系,则com.wuntee.rsaAuthenticationManager不会自动成为com.wuntee.taac的依赖关系

这些都将与您描述的症状一致。

09-15 18:14