javajbossjboss7.x

Deploy time error (java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider ) in Jboss 7


Our project is on a Jetty server and works completely. Then we deployed this project on a Jboss 7 server, but there are some errors.

I made a war file and copied and pasted into the E:\jboss-as-7.1.1.Final\standalone\deployments folder and auto-deployed. At startup it gave this error:

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

** I tried to add to the path by editing jboss_home/modules/sun/jdk/main/module.xml and adding path com/sun/net/ssl/internal, but the error was not removed **

So how to remove this error?

Detail Error :

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]

Solution

  • Jboss 7 looks for dependencies in the modules folder. You can't just go in the modules.xml file and add new modules if they don't actually exist.

    What you need to do is find out whether there is a jar containing the missing class, if it exist then you need to add a reference to that module from your project, if does not exist, you need to manually download it and copy it to the modules directory and then reference it.

    You have several ways you can reference it:

    1. Add a classpath entry to your manifest file: Classpath: com.sun.net
    2. Add a global reference to that module in your standalone.xml by adding a Global module.

    For more details, look here.