WildFly 14 missing modules : org/apache/commons/configuration - wildfly

WildFly 14 is missing the org/apache/commons/configuration module in the package , same for wildfly 15.
Is this removed from wildfly distributions for some reason?

This was removed in WildFly 9 as far as I can tell, https://github.com/wildfly/wildfly/pull/7297. You'll need to include the dependency in your deployment if you require it.

Related

Wicket 9 & Tomcat 10 Can't Cast jakarta.servlet.Filter

I'm trying to use the Wicket Project 'QuickStart' with
Netbeans 11, Java 11, Tomcat 10, Wicket 9, and Ubuntu 18.04.
When I install the WAR package and start it, it throws:
20-May-2020 09:23:37.067 GRAVE [] org.apache.catalina.core.StandardContext.filterStart Exception at start [wicket.quickstart]
java.lang.ClassCastException: class org.apache.wicket.protocol.http.WicketFilter cannot be cast to class jakarta.servlet.Filter (org.apache.wicket.protocol.http.WicketFilter is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader)
Has anyone seen this issue before and if so, what can I do to resolve this?
The issue is that Tomcat 10 uses jakarta.** packages (Jakarta EE 9) while Wicket 9.x is still based on javax.** packages (Java EE 8).
The solutions are:
Use Tomcat 9.x
Use https://github.com/apache/tomcat-jakartaee-migration to migrate the Wicket application (the .war file) from javax to jakarta
Deploy the javax.** based application into $TOMCAT10_HOME/webapps-javaee/ folder. It will be automatically migrated to jakarta.** by Tomcat.
Don't use Tomcat 10 yet, it works with the new jakarta packages.
Switch to version 9 instead.
To make wicket 9 work with with jakarta, e.g. if using tomcat 10 or spring boot 3, you have to convert some jars. There is the tool jakartaee-migration which does this for a given jar. So apply it at least to these 4 jars and create new ones - I used -jakarta as appendix:
wicket-core -> wicket-core-jakarta
wicket-util -> wicket-util-jakarta
wicket-request -> wicket-request-jakarta
commons-fileupload -> commons-fileupload
Also create proper pom files put all together into your local/shared repository.
To use it, add the new dependencies and exclude the old ones where necessary. Run mvn dependency:tree until nothing bogus gets picked up.
Congrats - you now have wicket 9 for jakarta.

java.lang.ClassCastException: __redirected.__XMLInputFactory cannot be cast to org.codehaus.stax2.XMLInputFactory2

I am migration Java Web Application from jboss 6.0 to wildfly 11. I am getting
"java.lang.ClassCastException: __redirected.__XMLInputFactory cannot
be cast to org.codehaus.stax2.XMLInputFactory2" while running the code
on wildfly 11.0.0.Final. Junit tests are working without error.
Looks like there is some dependency issue in wildfly but unable to find any solution. Appreciate any help to resolve this issue..
I have included following woodstox dependencies in pom.
woodstox-core-asl 4.4.1
stax2-api 3.1.4
Thanks
Sanjay
This is caused by duplicate classes in the classpath.
Wildfly ships stax2-api as part of the woodstocks module, see modules/system/layers/base/org/codehaus/woodstox/main/ in the wildfly dist folder.
If you also have it in your application's lib folder, this will cause issues.
The solution is to either set the dependency to <scope>provided</scope> (or build) in pom.xml, or if you really need a special version, exclude wildfly's module via jboss-deployment-structure.xml.
See https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly for more information on classloading in Wildfly.

Grails 3 in Tomcat 6

I am trying to deploy my grails app version 3 on a Tomcat 6 container and I am facing the following error when tomcat is trying to deploy the app:
Jan 05, 2016 5:24:44 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\murruer\DEV\apache-tomcat-6.0.37\webapps\grailstomcat-0.1\WEB-INF\lib\tomcat-embed-core-8.0.28.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Is it possible to deploy a Grails 3 application into Tomcat 6??
Thank your.
Best Regards.
If you read the official Grails Doc you can see this:
Note that by default Grails will include an embeddable version of Tomcat inside the WAR file, this can cause problems if you deploy to a different version of Tomcat. If you don't intend to use the embedded container then you should change the scope of the Tomcat dependencies to provided prior to deploying to your production container in build.gradle:
provided "org.springframework.boot:spring-boot-starter-tomcat"
--Edit--
Another problem deploying a Grails 3x war into a Tomcat 6 server is that it's not suported.
The official documentatiotion says:
Grails runs on any container that supports Servlet 3.0 and above and is known to work on the following specific container products:
Tomcat 7
GlassFish 3 or above
Resin 4 or above
JBoss 6 or above
Jetty 8 or above
Oracle Weblogic 12c or above
IBM WebSphere 8.0 or above

How do I ignore/upgrade a module in JBoss Wildfly 9?

I just downloaded Wildfly 9.0.0.CR2 with Java 7 on Mac 10.9.5. I notice by default, Wildfly 9 includes a bouncycastle module (modules/system/layers/base/org/bouncycastle/main/bcprov-jdk15on-1.52.jar) . I would like to install another bouncycastle module in Wildfly (bcprov-jdk16-1.46.jar). Is there a way I can disable the one that JBoss has included? When I tried to delete the module Jboss included (the modules/system/layers/base/org/bouncycastle/ folder), I get the error upon JBoss startup
08:36:19,086 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:131)
at org.jboss.as.server.ServerService.boot(ServerService.java:350)
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:271)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: WFLYCTL0083: Failed to load module org.jboss.as.weld
at org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:155)
at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_4(StandaloneXml.java:433)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:144)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:106)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123)
... 3 more
You might have a look at this discussion, it is almost the same thing you want to do (opposite direction w.r.t. versions):
BouncyCastle 1.51 loading in war on Wildfly 8.0
The long and the short of it is, you can create a custom module (or, I think, another slot for the existing module?) and reference that one in your jboss-deployment-structure.xml instead of the default module wildfly is bringing with it.
If you don't want/need BC as a module, you could also just include it in the lib folder of your EAR/WAR and it will be loadable from there.
Our deployment structure looks essentially like this:
my.ear
+ lib/ <-- dependencies for multi-submodule deployment
+ META-INF/ <-- application.xml defines submodule(s) e.g. web.war,
<-- also jboss-deployment-structure.xml to include/export wildfly core modules for your EAR
+ web.war <-- our core deployment
And we include e.g. a different version of hibernate than in wildfly. I expect you can include a different BC version in your ear as well.
See also:
https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly
Custom module tutorial:
http://middlewaremagic.com/jboss/?p=1933
Similar issue with resolution: https://developer.jboss.org/thread/175395
WildFly uses modular classloading and as such not everything is on classpath of every module.
Deployment itself is just another module that gets extra dependencies based on what deployment descriptors tell server should be added.
When it comes to bouncycastle, there are modules that themselves require it, but that doesn't mean they will expose this dependency to your deployment.
There was a bug in 8.0 that caused that BC was exposed to user deployment in case when user deployment was using web services. This was fixed since than.
Given that you use WildFly 9 that shouldn't a problem anymore.
As other suggested, you can create new module with different name or at least different slot name, which you can than include via your jboss-deployment-structure.xml
Just btw, bcprov-jdk16-1.46 is much older than what is provided in WildFly.

Adding JDK dependencies to jboss 6

I am using JBOSS EAP 6.1 using JDK 1.6. I have registered all my dependencies as static module. I have dependencies on JDK apis.
During deployment I am faced with following issue:
java.lang.NoClassDefFoundError: javax/crypto/CipherInputStream
java.lang.NoClassDefFoundError: org/omg/CORBA/portable/IDLEntity
java.lang.NoClassDefFoundError: javax/swing/ImageIcon
I was able to resolve the above issue by creating a static module and adding rt.jar and des.jar as resources in moudle.xml but then I am facing another issue regarding algorithm not found.
java.security.NoSuchAlgorithmException: PBEWithMD5AndDES SecretKeyFactory not available
at javax.crypto.SecretKeyFactory.(DashoA13*..)
at javax.crypto.SecretKeyFactory.getInstance(DashoA13*..)
at utilities.algorithm.DesEncrypter.(DesEncrypter.java:49)
at utilities.algorithm.DesEncrypter.decryptStream(DesEncrypter.java:177)
I want to add include these dependencies from system without creating static module as shown on different forums.
https://community.jboss.org/thread/195182
https://community.jboss.org/message/717881#717881#717881
Can we do it in for EAP 6.1 or its just available for JBOSS AS 7. Can someone please show me an example for EAP 6.1.
I have been able to fix the issue. The api included in JDK are exported in different modules and we need to include those modules in our modules as dependences.
For Example: org/omg/CORBA/portable/IDLEntity was available in org.omg.api module.
Similarly, javax/swing/ImageIcon & javax/crypto/CipherInputStream was available in javax.api.