4

我们的项目在 Jetty 服务器上并且可以完全运行,然后这个项目部署在 Jboss 7 服务器上,但是有一些错误。

我在 E:\jboss-as-7.1.1.Final\standalone\deployments 文件夹中制作了战争文件并复制并粘贴过去,然后自动部署开始并给出此错误:

nested exception is java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider

我尝试在编辑 jboss_home/modules/sun/jdk/main/module.xml 中添加路径并添加路径 com/sun/net/ssl/internal ,但错误未删除

那么如何消除这个错误呢?

详细错误:

13:33:03,769 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-1) Context initialization failed: org.springframework.beans.factor
y.BeanCreationException: Error creating bean with name 'log4jInitialization' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocati
on of init method failed; nested exception is java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) [org.s
pringframework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [org.spri
ngframework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [org.spring
framework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [org.springframework.beans-3.1.0.M1.jar:
3.1.0.M1]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [org.springframework.
beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [org.springframework.beans-3.1.0.M1.jar:3.
1.0.M1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [org.springframework.beans-3.1.0.M1.jar:3.1.
0.M1]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563) [org.springfr
amework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:900) [org.springf
ramework.context-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455) [org.springframework.context-3.1.0.M
1.jar:3.1.0.M1]
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:294) [org.springframework.web-3.1.0.M1.jar:3.1.0.M1
]
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:215) [org.springframework.web-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [org.springframework.web-3.1.0.M1.jar:3.
1.0.M1]
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_01]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_01]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_01]
Caused by: java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider
        at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.7.0_01]
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404) [rt.jar:1.7.0_01]
        at java.lang.Class.getConstructor0(Class.java:2714) [rt.jar:1.7.0_01]
        at java.lang.Class.newInstance0(Class.java:343) [rt.jar:1.7.0_01]
        at java.lang.Class.newInstance(Class.java:325) [rt.jar:1.7.0_01]
        at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:336) [log4j-1.2.16.jar:]
        at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:123) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:752) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:547) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:415) [log4j-1.2.16.jar:]
        at org.springframework.util.Log4jConfigurer.initLogging(Log4jConfigurer.java:72) [org.springframework.core-3.1.0.M1.jar:3.1.0.M1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_01]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_01]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_01]
        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_01]
        at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273) [org.springframework.core-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.config.MethodInvokingFactoryBean.doInvoke(MethodInvokingFactoryBean.java:162) [org.springframework.beans-3.1.0
.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.config.MethodInvokingFactoryBean.afterPropertiesSet(MethodInvokingFactoryBean.java:152) [org.springframework.b
eans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479) [or
g.springframework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) [org.s
pringframework.beans-3.1.0.M1.jar:3.1.0.M1]
        ... 20 more
Caused by: java.lang.ClassNotFoundException: com.sun.net.ssl.internal.ssl.Provider from [Module "deployment.mwp.war:main" from Service Module Loader]
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
        ... 43 more

13:33:03,856 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/mwp]] (MSC service thread 1-1) Exception sending context initialize
d event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'log4jInitialization' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nest
ed exception is java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) [org.s
pringframework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [org.spri
ngframework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [org.spring
framework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [org.springframework.beans-3.1.0.M1.jar:
3.1.0.M1]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [org.springframework.
beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [org.springframework.beans-3.1.0.M1.jar:3.
1.0.M1]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [org.springframework.beans-3.1.0.M1.jar:3.1.
0.M1]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563) [org.springfr
amework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:900) [org.springf
ramework.context-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455) [org.springframework.context-3.1.0.M
1.jar:3.1.0.M1]
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:294) [org.springframework.web-3.1.0.M1.jar:3.1.0.M1
]
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:215) [org.springframework.web-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [org.springframework.web-3.1.0.M1.jar:3.
1.0.M1]
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_01]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_01]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_01]
Caused by: java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider
        at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.7.0_01]
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404) [rt.jar:1.7.0_01]
        at java.lang.Class.getConstructor0(Class.java:2714) [rt.jar:1.7.0_01]
        at java.lang.Class.newInstance0(Class.java:343) [rt.jar:1.7.0_01]
        at java.lang.Class.newInstance(Class.java:325) [rt.jar:1.7.0_01]
        at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:336) [log4j-1.2.16.jar:]
        at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:123) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:752) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:547) [log4j-1.2.16.jar:]
        at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:415) [log4j-1.2.16.jar:]
        at org.springframework.util.Log4jConfigurer.initLogging(Log4jConfigurer.java:72) [org.springframework.core-3.1.0.M1.jar:3.1.0.M1]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_01]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_01]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_01]
        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_01]
        at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273) [org.springframework.core-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.config.MethodInvokingFactoryBean.doInvoke(MethodInvokingFactoryBean.java:162) [org.springframework.beans-3.1.0
.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.config.MethodInvokingFactoryBean.afterPropertiesSet(MethodInvokingFactoryBean.java:152) [org.springframework.b
eans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479) [or
g.springframework.beans-3.1.0.M1.jar:3.1.0.M1]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) [org.s
pringframework.beans-3.1.0.M1.jar:3.1.0.M1]
        ... 20 more
Caused by: java.lang.ClassNotFoundException: com.sun.net.ssl.internal.ssl.Provider from [Module "deployment.mwp.war:main" from Service Module Loader]
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
        ... 43 more

13:33:04,076 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-1) Error listenerStart
13:33:04,078 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-1) Context [/mwp] startup failed due to previous errors
13:33:04,094 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/mwp]] (MSC service thread 1-1) Closing Spring root WebApplicationCo
ntext
13:33:04,107 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.web.deployment.default-host./mwp: org.jbos
s.msc.service.StartException in service jboss.web.deployment.default-host./mwp: JBAS018040: Failed to start context
        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_01]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_01]
4

6 回答 6

3

Jboss 7 在模块文件夹中查找依赖项。如果新模块实际上不存在,您不能只进入 modules.xml 文件并添加新模块。

您需要做的是找出是否存在包含缺少的类的jar,如果存在则需要从项目中添加对该模块的引用,如果不存在,则需要手动下载并将其复制到模块目录,然后引用它。

您可以通过多种方式引用它:

  1. 在清单文件中添加一个类路径条目:Classpath: com.sun.net
  2. 通过添加Global module在您的standalone.xml 中添加对该模块的全局引用。

更多详情,请看这里

于 2012-07-02T08:18:36.903 回答
2

我刚刚在 jboss 7.1.1Final 中遇到了这个问题。我从 jdk 7 中的 rt.jar 的 com.sun.net.ssl 包中为 X509TrustManager.java 获取它。

我通过添加解决了它

<module xmlns="urn:jboss:module:1.1" name="sun.jdk">
<resources>
    <!-- currently jboss modules has not way of importing services from
    classes.jar so we duplicate them here -->
    <resource-root path="service-loader-resources"/>
</resources>
<dependencies>
    <system export="true">
        <paths>
            ...
      <path name="com/sun/net/ssl"/>
           ...
        </paths>
        <exports>
            <include-set>
                <path name="META-INF/services"/>
            </include-set>
        </exports>
    </system>
</dependencies>

在 jboss 7 的 modules/sun 下的 module.xml 中。

希望这会帮助任何人:)

于 2013-02-15T10:40:16.017 回答
0

我看到的问题是java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider 您需要在 Web 应用程序的清单文件中添加依赖项,我的建议是,首先阅读手册中的该部分

To import it using jboss-deployment-structure.xml:

<dependencies>

  <module name="system" >

     <imports>

        <include-set>

           <path name="com/sun/ssl/internal/ssl"/>

         </include-set>

      </imports>

    </module>

</dependencies>

请参考以下链接。

https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

于 2012-07-02T08:20:04.750 回答
0

1.打开sun.jdk模块的模块定义。对于最新的 EAP,路径为:JBOSS_HOME\modules\system\layers\base\sun\jdk\main\module.xml

将以下内容添加到路径部分:

<path name="com/sun/ssl/internal/ssl"/>
<path name="com/sun/net/ssl"/>

2.将以下内容添加到您的 WEB-INF 文件夹中的 jboss-deployment-structure.xml

<dependencies>
    <module name="sun.jdk"/>
</dependencies>
于 2014-08-21T12:28:27.740 回答
0

自 1.4 以来,所有 Oracle/Sun JDK 都提供了该类,即 8-9 年。

任何一个:

  1. 您使用的是非 Sun/Oracle JDK
  2. 您在代码或配置文件中使用类名 com.sun.net.ssl.internal.ssl.Provider,或者
  3. 您的 Java 安装存在严重问题
于 2012-07-02T10:21:41.393 回答
0

将以下代码添加到文件 => WEB_INF/jboss-deployment-structure.xml

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.jboss.logmanager" />
            <system export="true">
                <paths>
                    <path name="com/sun/net/ssl/internal/ssl"/>
                   </paths>
            </system>
        </dependencies>
     </deployment>
</jboss-deployment-structure>
于 2015-08-26T05:29:12.330 回答