Axis2 generated Client to web service call - Unable to access unsupported property javax.xml.stream.supportDTD - axis2

I am getting the following exception when I access the web service from my Axis2 generated stub client.
Can anyone put some light one it?
Thanks.
Caused by: org.apache.axis2.AxisFault: Unable to access unsupported property javax.xml.stream.supportDTD
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at amdocs.cl.utils.CollectionsServiceStub.GetEquipmentInfo(CollectionsServiceStub.java:267)
at amdocs.cl.utils.DDPCollectionConnectorUtils.getEquipmentInfo(DDPCollectionConnectorUtils.java:162)
... 7 more
Caused by: java.lang.IllegalArgumentException: Unable to access unsupported property javax.xml.stream.supportDTD
at weblogic.xml.stax.ConfigurationContextBase.check(ConfigurationContextBase.java:60)
at weblogic.xml.stax.ConfigurationContextBase.setProperty(ConfigurationContextBase.java:54)
at weblogic.xml.stax.XMLStreamInputFactory.setProperty(XMLStreamInputFactory.java:280)
at org.apache.axiom.util.stax.dialect.StAXDialectUtils.disallowDoctypeDecl(StAXDialectUtils.java:40)
at org.apache.axiom.util.stax.dialect.UnknownStAXDialect.disallowDoctypeDecl(UnknownStAXDialect.java:39)
at org.apache.axiom.om.util.StAXParserConfiguration$4.configure(StAXParserConfiguration.java:116)
at org.apache.axiom.om.util.StAXUtils$7.run(StAXUtils.java:520)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axiom.om.util.StAXUtils.newXMLInputFactory(StAXUtils.java:495)
at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory_perClassLoader(StAXUtils.java:566)
at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:172)
at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:137)
at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:196)
at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:64)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)

I too had the same issue and finally found that the problem is with incorrect context config.
Axis2 configuration context is being created with weblogic.jar file instead of axis2 jar, so change the build class path order. First point all the axis2 jars and atlast point the weblogic.jar in class path.

I resolved this by adding jax-rt jar in my classPath.
Or Add below dependency in your pom
<depepdency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.10</version>
</dependency>

Related

Email from the application is not working from glassfish 6.0.0 due to conflict of javax mail library

Email from the application is not working from glassfish 6.0.0 due to conflict of javax mail library with the glassfish 6 mail libraries from a modules folder.
We have REST application implemented using jersey 3.0.0 deployed on glassfish 6. We are using log4j for logging.
When there is an error, it failed to send the email. I tried the same application from localhost using tomcat it is sending an email.
This is what I added to my pom.xml
-- Jakarata.mail (1.6.5) jar file and log4j(1.2.17)
I also tried replacing log4J 1.2.17 to log4j2.17.1
I keep getting ClassCastException or ClassNotFoundException or NoSuchMethodError.
With Jakarta.mail.jar I am receiving below error
java.lang.ClassCastException: com.sun.mail.handlers.text_plain cannot be cast to javax.activation.DataContentHandler
I tried replacing Jakarta.mail.jar with (com.sun.mail) javax.mail.jar 1.6.2
I received below error
**ERROR An exception occurred processing Appender LogToMail org.apache.logging.log4j.core.appender.AppenderLoggingException: java.lang.NoSuchMethodError: com.sun.mail.util.MimeUtil.cleanContentType**
Tried with mail.jar 1.4.7 instead of javax.mail.jar and activation.jar(1.1.1)
Getting below Error
**java.lang.NoSuchMethodError: com.sun.mail.util.PropUtil.getBooleanSessionProperty**
As there is already some other mail library there in classloader I removed the mail library from the application then I am getting
**Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
I tried copying jakarata.mail and jakarata.activation.jar under glassfish/domains/domain1/lib/ext folder but got NOSTMP provider**.
If I copy javax.mail.jar and activation.jar under glassfish/domains/domain1/lib/ext folder then same error **“ERROR An exception occurred processing Appender LogToMail org.apache.logging.log4j.core.appender.AppenderLoggingException: java.lang.NoSuchMethodError: com.sun.mail.util.MimeUtil.cleanContentType”**
I also tried adding mail.jar and activation.jar under glassfish/domains/domain1/lib/ext folder
**ERROR Caught exception while sending e-mail notification.: javax.mail.NoSuchProviderException: smtp javax.mail.NoSuchProviderException: smtp**
I refer to the below link. Not completely understood what xbootclasspath does but tried adding the below lines to domain.xml.
DCH class error with JavaMail
-Xbootclasspath/p:${com.sun.aas.installRoot}/modules/jakarta.mail.jar
-Xbootclasspath/p:${com.sun.aas.installRoot}/modules/jakarta.activation.jar
if anyone is able to successfully send an email from glassfish 6.0.0
Appreciate any help on this.
GlassFish already included Jakarta Mail. There's no need to include it in your pom. When you do, it will conflict, as you per the errors you got.
Jakarata.mail 1.6.5 which you use in your application is old, it uses the javax.mail package prefix. GlassFish 6 uses the jakarta package prefix. You should upgrade to jakarta.mail-api 2.1.0 and use it only for compilation, don't add it to your application WAR (provided scope):
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>

Apache CXF issue on Glassfish

I created a web-service app based on Apache CXF (2.7.5), deployed it on a Glassfish 3.0.1 and it works fine till I turn on WS-Sec support. Then I get the following exception when I try to do a web-service request:
Caused by: javax.xml.crypto.NoSuchMechanismException: class configured for XMLSignatureFactory(provider: ApacheXMLDSig)cannot be found.
at javax.xml.crypto.dsig.XMLDSigSecurity.doGetImpl(Unknown Source) ~[webservices-osgi.jar:1.0]
at javax.xml.crypto.dsig.XMLDSigSecurity.getImpl(Unknown Source) ~[webservices-osgi.jar:1.0]
at javax.xml.crypto.dsig.XMLDSigSecurity.getImpl(Unknown Source) ~[webservices-osgi.jar:1.0]
at javax.xml.crypto.dsig.XMLSignatureFactory.findInstance(Unknown Source) ~[webservices-osgi.jar:1.0]
at javax.xml.crypto.dsig.XMLSignatureFactory.getInstance(Unknown Source) ~[webservices-osgi.jar:1.0]
at org.apache.ws.security.message.WSSecSignature.init(WSSecSignature.java:127) ~[wss4j-1.6.10.jar:1.6.10]
at org.apache.ws.security.message.WSSecSignature.<init>(WSSecSignature.java:120) ~[wss4j-1.6.10.jar:1.6.10]
at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.getSignatureBuilder(AbstractBindingBuilder.java:1730) ~[cxf-rt-ws-security-2.7.5.jar:2.7.5]
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignature(AsymmetricBindingHandler.java:546) ~[cxf-rt-ws-security-2.7.5.jar:2.7.5]
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignBeforeEncrypt(AsymmetricBindingHandler.java:147) ~[cxf-rt-ws-security-2.7.5.jar:2.7.5]
... 273 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory
at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:744) ~[felix.jar:na]
at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:61) ~[felix.jar:na]
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1656) ~[felix.jar:na]
at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ~[na:1.6.0_43]
It seems that CXF invokes the XMLSignatureFactory class contained by Glassfish's default webservice provider implementation instead of invoking it's own one (it's in the xmlsec.jar file). All CXF files are packed into my war file and also have the <class-loader delegate="false" /> set in sun-web.xml.
Can someone help me why the Glassfish classloader works this way and how could I fix this?
I managed to find out that Glassfish (at least the 3.0.1 version) modifies the default class loading behavior to "protect" some packages (mostly javax. packages) in it's classpath. That's the reason why it finds and uses classes in it's modules directory instead of the one in my war's lib.
To solve this a JVM option should be added to the domain.xml:
<jvm-options>-Dcom.sun.enterprise.overrideablejavaxpackages=javax.xml.crypto,javax.xml.crypto.dsig</jvm-options>
With this Glassfish will allow to use your libs in your war file. But even with this setting it's problematic to use CXF with WS-Securityy along with Metro. The better solution is to use a Glassfish with only Web Profile not Full Profile as Web Profile doesn't have Metro included.

Apache HttpClient inside JAR looking for JBoss reference?

I am using the Apache HttpClient libs to handle my communication with an API. All of my code compiles and runs without error when I unit test the exploded code. However, when I JAR my source and test the code in a isolated integration test I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logmanager/Logger$AttachmentKey
at org.slf4j.impl.Slf4jLoggerFactory.<clinit>(Slf4jLoggerFactory.java:31)
at org.slf4j.impl.StaticLoggerBinder.getLoggerFactory(StaticLoggerBinder.java:33)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:240)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:159)
at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:178)
at opart.api.client.trasnsport.Transport.get(Transport.java:81)
at opart.api.client.dao.objects.ObjectsDao.getInterestingObjects(ObjectsDao.java:70)
at opart.api.client.OpartApiClient.getInterestingObjects(OpartApiClient.java:79)
at ApiTest.interesting(ApiTest.java:32)
at ApiTest.main(ApiTest.java:21)
Caused by: java.lang.ClassNotFoundException: org.jboss.logmanager.Logger$AttachmentKey
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 14 more
When I try to instantiate a DefaultHttpClient object thusly:
DefaultHttpClient defaultHttpClient = new DefaultHttpClient();
The libs I have included in my JAR are:
guava-r09.jar
commons-logging-1.1.1.jar
httpclient-4.1.2.jar
httpcore-4.1.2.jar
gson-1.7.1.jar
Any ideas as to why it is trying to reference JBoss?
The solution I found was to use the zipfileset ant target which safely explodes the contents of the JARchives inside the root of the uber JAR.

spring Jaxb2Marshaller+contextPath+tomcat embedded in maven throws

I'm using spring's Jaxb2Marshaller (without web services) to unmarshal some xml. The xml code is code-gen via maven-jaxb-plugin, and I instantiate the Jaxb2Marshaller in spring via:
<bean id="unmarshaller" class="...Jaxb2Marshaller" p:contextPath="my.package.path" />
Then start with:
mvn clean package
mvn tomcat:run
The first unmarshaller is created fine, the second throws with org.springframework.oxm.jaxb.JaxbSystemException because it can't find ObjectFactory (which is generated by the maven-jaxb-plugin, and I've verified is in fact present in the jar, in the correct package).
I actually have two unmarshallers, (although I've tried with one unmarshaller and contextPath with colon separated package paths, with same results).
I don't think this is generally a problem with spring or my configuration, because if I deploy into a full tomcat container it works fine. I did notice that maven puts tomcat in my project/target/tomcat folder and there are some differences, such as there is no lib directory. I actually don't know what all the differences are between embedded tomcat and a regular installation.
Can someone explain:
1) exactly how embedded tomcat differs from a regular installation
2) if there are known limitations
3) if it can be configured to work properly in this situtation
Full stack trace:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'unmarshaller' defined in class path resource [spring.xml]: Invocation of init method failed; nested exception is org.springframework.oxm.jaxb.JaxbSystemException: "my.package.path" doesnt contain ObjectFactory.class or jaxb.index; nested exception is javax.xml.bind.JAXBException: "my.package.path" doesnt contain ObjectFactory.class or jaxb.index
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
For anyone else who runs across this, I eventually solved the problem by using classesToBeBound property instead of contextPath. The reason I had initially avoided classesToBeBound was that I thought I had to specify every single class in the model in the classesToBeBound list, which isn't the case. You simply specify the class that has the #XmlRootElement annotation.

Struts2 Error when Deploying: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory

I'm creating a basic Struts2, Maven webApp and getting this error when I deploy to Tomcat 6 or Jetty. Has anyone seen this?
2010-07-29 15:33:38.801::WARN: failed struts2
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/C:/workspaces/test/test/target/work/webapp/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:589)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:110)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:357)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:293)
at org.mortbay.jetty.plugin.Jetty6RunWar.execute(Jetty6RunWar.java:67)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
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.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/C:/workspaces/ulearn/ulearn/target/work/webapp/WEB-INF/lib/struts2-core-2.0.11.2.jar!/struts-default.xml:30:72 - bean - jar:file:/C:/workspaces/ulearn/ulearn/target/work/webapp/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193)
... 47 more
Using Maven...
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.1.8.1</version>
</dependency>
web.xml
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Look's pretty straight forward, I don't understand why it won't load. I followed the basic tutorial. I googled for this error message, and was unable to find anything relevant.
Your problem is actually quite clear if you read the stack trace:
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the
name xwork has already been loaded by bean -
jar:file:/C:/workspaces/ulearn/ulearn/target/work/webapp/WEB-INF/lib/struts2-core-2.0.11.2.jar!/struts-default.xml:30:72
- bean -
jar:file:/C:/workspaces/ulearn/ulearn/target/work/webapp/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72
You have a copy of struts2-core-2.0.11.2.jar and a copy of struts2-core-2.1.8.1.jar in your WEB-INF/lib directories. I think you should only have one of them. Do some cleanup (running a mvn clean might be enough).
PS: I have no idea why you also have stuff coming from C:/workspace/test as show be the first line:
jar:file:/C:/workspaces/test/test/target/work/webapp/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72
There is definitely something weird and messy with your classpath. I don't have any explanation beyond the one I gave above though.
Agree with the above answer
Check your library and classpath for the above jars and fix them
Sometimes even if the jars are not seen in the IDE, they are present int the build files, So a fix of the classpath and a CLEAN AND BUILD should resolve the problem.
I think struts2-core-2.1.8.1.jar copy or you have included this jar file some where in your webapplication so remove it and continue
Problem: The conflict occurred as 2 files of different versions are being loaded by the web container
Solution: Just go to path
C:/workspaces/ulearn/ulearn/target/work/webapp/WEB-INF/lib/ of your computer and delete the struts2-core-2.0.11.2.jar file and only keep the latest one. If this type of conflict also occurs with some other file then delete that file also
After this no exception will be there.
I have also encountered this problem recently. Clean the cache and rebuild the project is not valid for my error.
I tried to delete the conflicting struts-default.xml file, but I didn't find it and the struts-default.xml file is a read-only file so I can't to modify it.
My final solution is to remove the extra Web* under Project Structure--Modules--MyFirstProject (project name), leaving only one Web and modifying Web Resource Directories as WebRoot.
It works for me! Hope I can help others.
​​​​​​​​​​here