XMLStreamException :Trying to output second root, StaXparser - java

writer.writeStartElement(startElement.getName().getLocalPart());
//when i run on standalone machine with one thread, it works fine, but when i run the multiple jobs with multiple threads on the server it gives me the following error at
writer.writeStartElement(startElement.getName().getLocalPart());
javax.xml.stream.XMLStreamException: Trying to output second root, <element>
ERROR [STDERR] (JBossQuartzScheduler_Worker-4) javax.xml.stream.XMLStreamException:
Trying to output second root, <handset>
ERROR [STDERR] (JBossQuartzScheduler_Worker-4) at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1473)
ERROR [STDERR] (JBossQuartzScheduler_Worker-4) at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1480)
ERROR [STDERR] (JBossQuartzScheduler_Worker-4) at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1508)
ERROR [STDERR] (JBossQuartzScheduler_Worker-4) at com.ctc.wstx.sw.BaseNsStreamWriter.checkStartElement(BaseNsStreamWriter.java:444)
ERROR [STDERR] (JBossQuartzScheduler_Worker-4) at com.ctc.wstx.sw.BaseNsStreamWriter.writeStartElement(BaseNsStreamWriter.java:292)

Related

Liferay 6.0.6 JSF 2 portlet deployment issue

I have strange issue with Liferay 6.0.6 portlet deployment to Jboss EAP 5.2 server
The code that was working for years suddenly stopped deploying. Portlet is using JSF 2.1.21
The Error from server log:
2021-03-10 13:38:10,918 INFO [STDOUT] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) Expanding: E:\Jboss\eap-5.2-Liferay-6.0.6\deploy\example-portlet-1.0-SNAPSHOT.war into E:\Jboss\eap-5.2-Liferay-6.0.6\jboss-as\server\default\javaiotmp\20210310133810918
2021-03-10 13:38:12,146 INFO [STDOUT] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) Copying 1 file to E:\Jboss\eap-5.2-Liferay-6.0.6\jboss-as\server\default\javaiotmp\20210310133810918\WEB-INF
2021-03-10 13:38:12,305 INFO [STDOUT] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) Copying 1 file to E:\Jboss\eap-5.2-Liferay-6.0.6\jboss-as\server\default\javaiotmp\20210310133810918\WEB-INF\classes
2021-03-10 13:38:12,324 INFO [STDOUT] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) Copying 1 file to E:\Jboss\eap-5.2-Liferay-6.0.6\jboss-as\server\default\javaiotmp\20210310133810918\WEB-INF\classes
2021-03-10 13:38:12,734 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) com.liferay.portal.kernel.xml.DocumentException: Error on line -1 of document : Premature end of file. Nested exception: Premature end of file.
2021-03-10 13:38:12,734 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:338)
2021-03-10 13:38:12,734 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.kernel.xml.SAXReaderUtil.read(SAXReaderUtil.java:115)
2021-03-10 13:38:12,734 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.tools.deploy.PortletDeployer.setupJSF(PortletDeployer.java:473)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.tools.deploy.PortletDeployer.getExtraContent(PortletDeployer.java:144)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.tools.deploy.BaseDeployer.updateWebXml(BaseDeployer.java:1414)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.tools.deploy.BaseDeployer.deployDirectory(BaseDeployer.java:493)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.tools.deploy.BaseDeployer.deployFile(BaseDeployer.java:828)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.tools.deploy.BaseDeployer.deployFile(BaseDeployer.java:765)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.tools.deploy.BaseDeployer.deploy(BaseDeployer.java:454)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.deploy.auto.PortletAutoDeployer.autoDeploy(PortletAutoDeployer.java:92)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.deploy.auto.PortletAutoDeployListener.deploy(PortletAutoDeployListener.java:78)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.kernel.deploy.auto.AutoDeployDir.processFile(AutoDeployDir.java:180)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.kernel.deploy.auto.AutoDeployDir.scanDirectory(AutoDeployDir.java:221)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.kernel.deploy.auto.AutoDeployScanner.run(AutoDeployScanner.java:49)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) Caused by: org.dom4j.DocumentException: Error on line -1 of document : Premature end of file. Nested exception: Premature end of file.
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at org.dom4j.io.SAXReader.read(SAXReader.java:482)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at org.dom4j.io.SAXReader.read(SAXReader.java:264)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:335)
2021-03-10 13:38:12,735 ERROR [STDERR] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) ... 13 more
2021-03-10 13:38:12,736 INFO [STDOUT] (com.liferay.portal.kernel.deploy.auto.AutoDeployScanner) 13:38:12,735 INFO [PortletAutoDeployListener:81] Portlets for E:\Jboss\eap-5.2-Liferay-6.0.6\deploy\example-portlet-1.0-SNAPSHOT.war copied successfully. Deployment will start in a few seconds.
Looking to liferay code it's failing trying to parse faces-config.xml file
faces-config.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
<application>
<resource-bundle>
<base-name>com.medpro.messageresources.MessageResources</base-name>
<var>msg</var>
</resource-bundle>
<locale-config>
<default-locale>en_US</default-locale>
<supported-locale>en_US</supported-locale>
</locale-config>
<message-bundle>com.medpro.messageresources.MessageResources</message-bundle>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<lifecycle>
<phase-listener>com.liferay.faces.util.lifecycle.DebugPhaseListener</phase-listener>
</lifecycle>
</faces-config>
I don't see any issues with
eap-5.2-Liferay-6.0.6\jboss-as\server\default\javaiotmp\20210310133810918\WEB-INF\faces-config.xml
I also tried to download http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd it's downloading valid xsd file.
Please advise what is possible reason for deployment failure ?
UPD:
please note that http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd is redirected to http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-facesconfig_2_0.xsd
if I replace the url in faces-config.xml to http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-facesconfig_2_0.xsd the deployment works fine.

JMSException for HornetQ in Wildfly 10

I am running more than one schedulers at a time with 1000ms and 500ms repeatInterval. The schedular reads some messages from queue, processes them, and store in a MySQL database. In middle of these process sometimes I am getting this kind of exceptions.
javax.jms.JMSException: AMQ119014: Timed out after waiting 30,000 ms for response when sending packet 71
2020-02-25 12:05:27,483 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:398)
2020-02-25 12:05:27,483 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:304)
2020-02-25 12:05:27,484 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext.sendFullMessage(ActiveMQSessionContext.java:378)
2020-02-25 12:05:27,484 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.sendRegularMessage(ClientProducerImpl.java:286)
2020-02-25 12:05:27,485 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.doSend(ClientProducerImpl.java:264)
2020-02-25 12:05:27,485 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.apache.activemq.artemis.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:122)
2020-02-25 12:05:27,485 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.doSendx(ActiveMQMessageProducer.java:477)
2020-02-25 12:05:27,486 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:173)
2020-02-25 12:05:27,486 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at com.ecomm.web.jmsqueue.SubmitToJMS.sendJMSMessagewithpriority(SubmitToJMS.java:197)
2020-02-25 12:05:27,486 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at com.ecomm.web.jmsqueue.InputMsgNewServerQueue.sendtosenderQueue(InputMsgNewServerQueue.java:78)
2020-02-25 12:05:27,486 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at com.pl4sms.web.thread.InputMsgSchHighPriority.execute(InputMsgSchHighPriority.java:36)
2020-02-25 12:05:27,487 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
2020-02-25 12:05:27,487 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
2020-02-25 12:05:27,487 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) Caused by: ActiveMQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=AMQ119014: Timed out after waiting 30,000 ms for response when sending packet 71]
2020-02-25 12:05:27,488 ERROR [stderr] (DefaultQuartzScheduler_Worker-5) ... 13 more
2020-02-25 12:05:27,488 ERROR [com.ecomm.web.jmsqueue.SubmitToJMS] (DefaultQuartzScheduler_Worker-5) javax.jms.JMSException: AMQ119014: Timed out after waiting 30,000 ms for response when sending packet 71
Could you describe your problem at least a little. A CONNECTION_TIMEDOUT jut means that you can't connect which is some configuration issue.
Your class com.ecomm.web.jmsqueue.SubmitToJMS is attempting to send a message, but this operation is timing out waiting for a response from the broker. You should either increase the time out on the client (e.g. by using the callTimeout parameter on the client URL, defaults to 30000 milliseconds) or investigate why the broker receiving the message isn't responding to the client within the allotted time.
Just in case. I had the same problem with camel routing.
.transacted() option removed this problem:
from("timer:hello?period=10s")
.routeId("hello1")
.transacted()
.setBody(simple("This is plain string"))
.to("jms:queue:consumerQueueName");
java 18 + wildfly 20 + artemis 2.25.0
all via JNDI

jrebel with debug mode can't update class

I started the project with jrebel's debug mode. When I update the class, jrebel throws the following log exception. Even though I didn't make any changes to the class, I just added a space. It is normal to start in start mode.
15:01:45,667 ERROR [STDERR] 2019-10-17 15:01:45 JRebel: ERROR Failed to transform class com/whir/rd/entryinvoice/actionsupport/InvoiceAction: java.lang.NoSuchMethodError: a
at com.zeroturnaround.javarebel.flw.a(SourceFile:106)
at com.zeroturnaround.javarebel.flw.doTransform(SourceFile:70)
at com.zeroturnaround.javarebel.flw.transform(SourceFile:57)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.applyTransformation(SourceFile:78)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.transform(SourceFile:70)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClassesImpl(Native Method)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClasses(SourceFile:149)
at com.zeroturnaround.javarebel.flv.a(SourceFile:106)
at com.zeroturnaround.javarebel.fkr.a(SourceFile:704)
at com.zeroturnaround.reload.al.d(SourceFile:588)
at com.zeroturnaround.reload.al.b(SourceFile:532)
at com.zeroturnaround.reload.al.a(SourceFile:74)
at com.zeroturnaround.reload.ao.a(SourceFile:833)
at com.zeroturnaround.reload.ao.a(SourceFile:749)
at com.zeroturnaround.reload.al.a(SourceFile:475)
at com.zeroturnaround.reload.b.m(SourceFile:513)
at com.zeroturnaround.reload.b.l(SourceFile:286)
at com.zeroturnaround.reload.b.k(SourceFile:57)
at com.zeroturnaround.reload.c.run(SourceFile:124)
15:01:45,738 ERROR [STDERR] 2019-10-17 15:01:45 JRebel: ERROR com.whir.rd.entryinvoice.actionsupport.InvoiceAction: java.lang.UnsupportedOperationException: JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClassesImpl(Native Method)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClasses(SourceFile:149)
at com.zeroturnaround.javarebel.flv.a(SourceFile:106)
at com.zeroturnaround.javarebel.fkr.a(SourceFile:703)
at com.zeroturnaround.reload.al.d(SourceFile:588)
at com.zeroturnaround.reload.al.b(SourceFile:530)
at com.zeroturnaround.reload.al.a(SourceFile:74)
at com.zeroturnaround.reload.ao.a(SourceFile:833)
at com.zeroturnaround.reload.ao.a(SourceFile:749)
at com.zeroturnaround.reload.al.a(SourceFile:474)
at com.zeroturnaround.reload.b.m(SourceFile:513)
at com.zeroturnaround.reload.b.l(SourceFile:284)
at com.zeroturnaround.reload.b.k(SourceFile:57)
at com.zeroturnaround.reload.c.run(SourceFile:123)
15:01:45,740 ERROR [STDERR] 2019-10-17 15:01:45 JRebel: ERROR Failed to transform class com/opensymphony/xwork2/ActionSupport: java.lang.NoSuchMethodError: a
at com.zeroturnaround.javarebel.flw.a(SourceFile:106)
at com.zeroturnaround.javarebel.flw.doTransform(SourceFile:70)
at com.zeroturnaround.javarebel.flw.transform(SourceFile:57)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.applyTransformation(SourceFile:78)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.transform(SourceFile:70)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClassesImpl(Native Method)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClasses(SourceFile:149)
at com.zeroturnaround.javarebel.flv.a(SourceFile:106)
at com.zeroturnaround.javarebel.fkr.a(SourceFile:704)
at com.zeroturnaround.reload.al.d(SourceFile:588)
at com.zeroturnaround.reload.al.b(SourceFile:532)
at com.zeroturnaround.reload.al.a(SourceFile:74)
at com.zeroturnaround.reload.ao.a(SourceFile:833)
at com.zeroturnaround.reload.ao.a(SourceFile:749)
at com.zeroturnaround.reload.al.a(SourceFile:475)
at com.zeroturnaround.reload.b.m(SourceFile:513)
at com.zeroturnaround.reload.b.l(SourceFile:286)
at com.zeroturnaround.reload.b.k(SourceFile:57)
at com.zeroturnaround.reload.c.run(SourceFile:124)
15:01:45,777 ERROR [STDERR] 2019-10-17 15:01:45 JRebel: ERROR com.opensymphony.xwork2.ActionSupport: java.lang.UnsupportedOperationException: JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClassesImpl(Native Method)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClasses(SourceFile:149)
at com.zeroturnaround.javarebel.flv.a(SourceFile:106)
at com.zeroturnaround.javarebel.fkr.a(SourceFile:703)
at com.zeroturnaround.reload.al.d(SourceFile:588)
at com.zeroturnaround.reload.al.b(SourceFile:530)
at com.zeroturnaround.reload.al.a(SourceFile:74)
at com.zeroturnaround.reload.ao.a(SourceFile:833)
at com.zeroturnaround.reload.ao.a(SourceFile:749)
at com.zeroturnaround.reload.al.a(SourceFile:474)
at com.zeroturnaround.reload.b.m(SourceFile:513)
at com.zeroturnaround.reload.b.l(SourceFile:284)
at com.zeroturnaround.reload.b.k(SourceFile:57)
at com.zeroturnaround.reload.c.run(SourceFile:123)
15:01:45,779 ERROR [STDERR] 2019-10-17 15:01:45 JRebel: ERROR Failed to transform class com/whir/component/actionsupport/BaseActionSupport: java.lang.NoSuchMethodError: a
at com.zeroturnaround.javarebel.flw.a(SourceFile:106)
at com.zeroturnaround.javarebel.flw.doTransform(SourceFile:70)
at com.zeroturnaround.javarebel.flw.transform(SourceFile:57)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.applyTransformation(SourceFile:78)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.transform(SourceFile:70)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClassesImpl(Native Method)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClasses(SourceFile:149)
at com.zeroturnaround.javarebel.flv.a(SourceFile:106)
at com.zeroturnaround.javarebel.fkr.a(SourceFile:704)
at com.zeroturnaround.reload.al.d(SourceFile:588)
at com.zeroturnaround.reload.al.b(SourceFile:532)
at com.zeroturnaround.reload.al.a(SourceFile:74)
at com.zeroturnaround.reload.ao.a(SourceFile:833)
at com.zeroturnaround.reload.ao.a(SourceFile:749)
at com.zeroturnaround.reload.al.a(SourceFile:475)
at com.zeroturnaround.reload.b.m(SourceFile:513)
at com.zeroturnaround.reload.b.l(SourceFile:286)
at com.zeroturnaround.reload.b.k(SourceFile:57)
at com.zeroturnaround.reload.c.run(SourceFile:124)
15:01:45,788 ERROR [STDERR] 2019-10-17 15:01:45 JRebel: ERROR com.whir.component.actionsupport.BaseActionSupport: java.lang.UnsupportedOperationException: JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClassesImpl(Native Method)
at com.zeroturnaround.reload.jvmti.MinimalInstrumentation.retransformClasses(SourceFile:149)
at com.zeroturnaround.javarebel.flv.a(SourceFile:106)
at com.zeroturnaround.javarebel.fkr.a(SourceFile:703)
at com.zeroturnaround.reload.al.d(SourceFile:588)
at com.zeroturnaround.reload.al.b(SourceFile:530)
at com.zeroturnaround.reload.al.a(SourceFile:74)
at com.zeroturnaround.reload.ao.a(SourceFile:833)
at com.zeroturnaround.reload.ao.a(SourceFile:749)
at com.zeroturnaround.reload.al.a(SourceFile:474)
at com.zeroturnaround.reload.b.m(SourceFile:513)
at com.zeroturnaround.reload.b.l(SourceFile:284)
at com.zeroturnaround.reload.b.k(SourceFile:57)
at com.zeroturnaround.reload.c.run(SourceFile:123)
15:01:45,847 INFO [STDOUT] 2019-10-17 15:01:45 JRebel: Reloading class 'com.whir.rd.entryinvoice.actionsupport.InvoiceAction'.
This makes me very confused. Is there a conflict between jrebel and debug mode? I am using the latest version of jrebel, virtual machine oracle jrockit 1.6
Yes JRebel should work with those debug options. I am unsure why you are getting these errors. I would need to see those logs to understand what is happening.
If you want to resolve it send me your logs to support#jrebel.com and I will be more than glad to assist further.
My name is Curtis Johnson and I am an engineer with JRebel team at Perforce. This appears to be some kind of bug in your application that may or may not have to do directly with JRebel. You would be best served working with our support team to resolve this issue. If you can send the JRebel log (instructions here) to support#jrebel.com, we can help you with this issue.

Error with JMS Appender in Log4j2 going to Wildfly 14

Using Log4j2 2.11.1 with Wildfly 14.0.1, OpenJDK 11. We have a custom OSGi client application that logs both to a console appender and to a JMS appender to send logging events to the Wildfly server.
Prior to Log4j2, we were programmatically sticking a JMS appender into our Log4j configuration, which worked fine. This really wasn't necessary so with our recent upgrade to Log4j2, I'm trying to using a log4j2.xml configuration to handle all of that and simplify our code.
We have a client class that this successfully connecting to our Wildfly JMS and receiving messages, using the following:
topicConnFacName: com.rsc.mmpl.TopicConnectionFactory
initialContextFacName: org.jboss.naming.remote.client.InitialContextFactory
URL: http-remoting://JDEVDWS166:9090
Topic name: com.rsc.mmpl.MsgHndlrTopic
My log4j2.xml configuration is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%p %d{yyyy-MMM-dd HH:mm:ss.SSS} %c{3}[line %L] - %m%n"/>
</Console>
<JMS name="jmsQueue" destinationBindingName="com.rsc.mmpl.MsgHndlrTopic"
factoryName="org.jboss.naming.remote.client.InitialContextFactory"
factoryBindingName="com.rsc.mmpl.TopicConnectionFactory"
ignoreExceptions="false"
providerURL="http-remoting://JDEVDWS166:9090">
<JsonLayout properties="true" complete="true"/>
</JMS>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
<AppenderRef ref="jmsQueue"/>
</Root>
</Loggers>
</Configuration>
If I comment out my JMS Appender, it works fine, so I know that my log4j is setup correctly from a classpath perspective (log4j core and api jars, as well as jackson jars, and jboss-client.jar are all on the overall classpath).
However, when running my client app with the JMS Appender, I get the following error:
[stderr] Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.jboss.remoting3.ConfigurationEndpointSupplier$Holder
[stderr] at org.jboss.remoting3.ConfigurationEndpointSupplier.get(ConfigurationEndpointSupplier.java:84)
[stderr] at org.jboss.remoting3.ConfigurationEndpointSupplier.get(ConfigurationEndpointSupplier.java:40)
[stderr] at org.wildfly.common.context.ContextManager.getPrivileged(ContextManager.java:286)
[stderr] at org.jboss.remoting3.Endpoint.getCurrent(Endpoint.java:81)
[stderr] at org.wildfly.naming.client.remote.RemoteNamingProviderFactory.getEndpoint(RemoteNamingProviderFactory.java:49)
[stderr] at org.wildfly.naming.client.remote.RemoteNamingProviderFactory.supportsUriScheme(RemoteNamingProviderFactory.java:40)
[stderr] at org.wildfly.naming.client.WildFlyRootContext.getProviderContext(WildFlyRootContext.java:784)
[stderr] at org.wildfly.naming.client.WildFlyRootContext.lookup(WildFlyRootContext.java:140)
[stderr] at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:409)
[stderr] at org.apache.logging.log4j.core.net.JndiManager.lookup(JndiManager.java:172)
[stderr] at org.apache.logging.log4j.core.appender.mom.JmsManager.createConnection(JmsManager.java:323)
[stderr] at org.apache.logging.log4j.core.appender.mom.JmsManager.<init>(JmsManager.java:250)
[stderr] at org.apache.logging.log4j.core.appender.mom.JmsManager.<init>(JmsManager.java:54)
[stderr] at org.apache.logging.log4j.core.appender.mom.JmsManager$JmsManagerFactory.createManager(JmsManager.java:130)
[stderr] at org.apache.logging.log4j.core.appender.mom.JmsManager$JmsManagerFactory.createManager(JmsManager.java:125)
[stderr] at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:113)
[stderr] at org.apache.logging.log4j.core.appender.mom.JmsAppender$Builder.build(JmsAppender.java:118)
[stderr] at org.apache.logging.log4j.core.appender.mom.JmsAppender$Builder.build(JmsAppender.java:50)
[stderr] at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123)
[stderr] at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
[stderr] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
[stderr] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
[stderr] at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
[stderr] at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
[stderr] at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
[stderr] at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
[stderr] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:619)
[stderr] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
[stderr] at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
[stderr] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:243)
[stderr] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
[stderr] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:174)
[stderr] at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:648)
[stderr] at com.rsc.delphi.logger.log4j.Log4jLogger.<init>(Unknown Source)
[stderr] ... 20 more
Looking at the Holder source, it appears something is going wrong with the static block there but I can't for the life of me figure out what.
Is there any way to get more information to figure out what is failing here? Again, programmatically connecting to my Wildfly JMS is fine, just seems to be an issue with Log4j2.
Thanks in advance.
Looking at it, my first guess is that the issue doesn't lie in the top of the stack trace there. That class loading issue is likely originating from where log4j2 is getting the connection to the WildFly naming interface.
It looks like a new InitialContextFactory (subclassed) module is now provided. That means you'll have to change:
org.jboss.naming.remote.client.InitialContextFactory
To:
org.wildfly.naming.client.WildFlyInitialContextFactory
Not having looked too deeply into it, it looks like the new ICF has a little more fancy logic for handling ClassLoader issues than the old ICF...

ClassNotFoundException: javax.xml.datatype.DatatypeFactory in wildfly-9.0.2.Final

Enviornment - AS#wildfly-9.0.2.Final,
BuildingTool#ant,
JDK#jdk1.8.0_66
Following class is accessed from my java code, which is causing errror.
javax.xml.datatype.DatatypeFactory
Java claas has been configured as a module
jaroneapi'==>module add --name=jaroneapi --resources=~/modules/jaroneapi.jar
package api.jarone.com.pojo;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.datatype.DatatypeFactory;
public class TestJarOneDetails {
public XMLGregorianCalendar convertDatetoXMLGregorian(String inputDate)
{
XMLGregorianCalendar date2 = null;
try {
System.out.println("[TestJarOne][convertDatetoXMLGregorian] This class is present in " +
"jaroneapi.jar which has been configured as a module 'module add --name=jaroneapi --resources=~/modules/jaroneapi.jar' ");
SimpleDateFormat fmt = new SimpleDateFormat("dd MMM yyyy HH:mm:ss");
Date date = fmt.parse(inputDate);
GregorianCalendar c = new GregorianCalendar();
c.setTime(date);
date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
} catch (Exception e) {
e.printStackTrace();
}
return date2;
}
}
Following error occurred while accessing above 'TestJarOneDetails' class.
10:43:13,337 ERROR [org.jboss.as.ejb3.invocation] (default task-1) WFLYEJB0034: EJB Invocation failed on component ClientTestHelperBean for method public abstract java.lang.String client.test.ejb.session.ClientTestHelperLocal.getValueByParamName(int,java.lang.String,java.lang.String) throws java.lang.Exception: javax.ejb.EJBException: WFLYEJB0442: Unexpected Error
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:184)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
Caused by: java.lang.NoClassDefFoundError: javax/xml/datatype/DatatypeFactory
at api.jarone.com.pojo.TestJarOneDetails.convertDatetoXMLGregorian(TestJarOneDetails.java:21)
at client.test.ejb.session.ClientTestHelperBean.getValueByParamName(ClientTestHelperBean.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Caused by: java.lang.ClassNotFoundException: javax.xml.datatype.DatatypeFactory from [Module "jaroneapi:main" from local module loader #707f7052 (finder: local module finder #11028347 (roots: /home/cmsim/manish/wildfly-9.0.2.Final/modules,/home/cmsim/manish/wildfly-9.0.2.Final/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
10:43:13,341 ERROR [stderr] (default task-1) javax.ejb.EJBException: WFLYEJB0442: Unexpected Error
10:43:13,341 ERROR [stderr] (default task-1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:184)
10:43:13,341 ERROR [stderr] (default task-1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
10:43:13,341 ERROR [stderr] (default task-1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
10:43:13,342 ERROR [stderr] (default task-1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
10:43:13,361 ERROR [stderr] (default task-1) Caused by: java.lang.ClassNotFoundException: javax.xml.datatype.DatatypeFactory from [Module "jaroneapi:main" from local module loader #707f7052 (finder: local module finder #11028347 (roots: /home/cmsim/manish/wildfly-9.0.2.Final/modules,/home/cmsim/manish/wildfly-9.0.2.Final/modules/system/layers/base))]
10:43:13,361 ERROR [stderr] (default task-1) at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
10:43:13,361 ERROR [stderr] (default task-1) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
10:43:13,361 ERROR [stderr] (default task-1) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
10:43:13,361 ERROR [stderr] (default task-1) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
I think i have to configure module 'jaroneapi' with some dependencies, but what will be dependency as 'javax.xml.datatype.DatatypeFactory' is present in /jdk1.8.0_66/jre/lib/rt.jar.
You need to add a dependency on the javax.api module in your module. For the command you just need to add --dependencies=javax.api
module add --name=jaroneapi --resources=~/modules/jaroneapi.jar --dependencies=javax.api
Or you can just edit the module.xml and add the dependency manually.
<module xmlns="urn:jboss:module:1.3" name="jaroneapi">
<resources>
<resource-root path="jaroneapi.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>

Categories