Log4j2 %rThrowable{full} not prinitng getLocalizedMessage - log4j2

It seems that the %rThrowable{full} pattern will not use getLocalizedMessage by default, while the %Throwable{full} will out put it.
The rThrowable{short.localizedMessage} is not working
My pattern is:
<property name="consolelayoutPattern">%-5p %-30.30c{2} %m%n%rThrowable{full}</property>
Any suggestion ?!

Please raise an issue on the log4j2 Jira issue tracker: https://issues.apache.org/jira/browse/LOG4J2

Related

Has anyone seen Swagger throw an exception because it can't find ClassGraph?

I'm using 2.1.16 of Swagger with Jetty/Jersey and I get this exception. I have tried to turn off classpath scanning with readAllResources(false) on SwaggerConfiguration because I don't want this feature anyway but it didn't help. I'm probably doing something wrong here. But what?
Thanks,
Jonathan
java.lang.NoClassDefFoundError: io/github/classgraph/ClassGraph
at io.swagger.v3.jaxrs2#2.1.6/io.swagger.v3.jaxrs2.integration.JaxrsAnnotationScanner.classes(JaxrsAnnotationScanner.java:60)
at io.swagger.v3.jaxrs2#2.1.6/io.swagger.v3.jaxrs2.integration.JaxrsApplicationAndAnnotationScanner.classes(JaxrsApplicationAndAnnotationScanner.java:10)
at io.swagger.v3.oas.integration#2.1.6/io.swagger.v3.oas.integration.GenericOpenApiContext.read(GenericOpenApiContext.java:555)
at io.swagger.v3.jaxrs2#2.1.6/io.swagger.v3.jaxrs2.integration.OpenApiServlet.doGet(OpenApiServlet.java:55)
at javax.servlet.api#3.1.0/javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.api#3.1.0/javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet#9.4.36.v20210114/org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:791)
at org.eclipse.jetty.servlet#9.4.36.v20210114/org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
at wicket.core#9.2.0/org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:293)
at wicket.core#9.2.0/org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:208)
at wicket.core#9.2.0/org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:307)
at org.eclipse.jetty.servlet#9.4.36.v20210114/org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
at org.eclipse.jetty.servlet#9.4.36.v20210114/org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
at org.eclipse.jetty.servlet#9.4.36.v20210114/org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet#9.4.36.v20210114/org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.Server.handle(Server.java:516)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
at org.eclipse.jetty.server#9.4.36.v20210114/org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
at org.eclipse.jetty.io#9.4.36.v20210114/org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io#9.4.36.v20210114/org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io#9.4.36.v20210114/org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util#9.4.36.v20210114/org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
at org.eclipse.jetty.util#9.4.36.v20210114/org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
at org.eclipse.jetty.util#9.4.36.v20210114/org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
at org.eclipse.jetty.util#9.4.36.v20210114/org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135)
at org.eclipse.jetty.util#9.4.36.v20210114/org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:773)
at org.eclipse.jetty.util#9.4.36.v20210114/org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:905)
at java.base/java.lang.Thread.run(Thread.java:835)
Swagger includes an outdated version of the io.github.classgraph that causes the java.lang.NoClassDefFoundError. I was able to exclude the classgraph version that was being included by Swagger and include the most recent version. After that I was missing the requires statement in module-info.java and now it works. This issue has been fixed in master of Swagger repo, but it is not yet in any release.
I had a problem with this with the maven dependency:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.4</version>
</dependency>
The only thing that worked for me was to downgrade to 1.6.3 and it got rid of the Cannot resolve io.github.classgraph:classgraph:4.8.138 error.

java.lang.ClassNotFoundException: org.apache.batik.dom.svg.SVGOMDocument

Following up many many questions and answers to use BATIK, I'm having trouble of fixing my error and I couldn't find anything that might help. And this question has no answer.
My problem is when I download the pdf on my application, the error occur(I even tried to include the jar):
java.lang.ClassNotFoundException: org.apache.batik.dom.svg.SVGOMDocument
In my jasper report I have this included:
<image>
<reportElement x="453" y="117" width="246" height="115"/>
<imageExpression class="net.sf.jasperreports.engine.JRRenderable"><![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstance(new java.io.File("C:\\Project\\myProject\\web-app\\images\\tomcat.svg"))]]>
</imageExpression>
</image>
Basically, my BuildConfig.groovy is like this:
inherits("global") {
excludes 'xml-apis', 'xml-apis-ext', 'xercesImpl'
}
and my dependencies:
compile("org.apache.xmlgraphics:fop:0.94",
"org.apache.xmlgraphics:batik-transcoder:1.7",
"org.apache.xmlgraphics:batik-codec:1.7",
"org.apache.xmlgraphics:batik-awt-util:1.7",
"org.apache.xmlgraphics:batik-bridge:1.7",
"org.apache.xmlgraphics:batik-dom:1.7",
"org.apache.xmlgraphics:batik-gvt:1.7",
"org.apache.xmlgraphics:batik-svg-dom:1.7",
"org.apache.xmlgraphics:batik-svggen:1.7",
"org.apache.xmlgraphics:batik-util:1.7",
"org.apache.xmlgraphics:batik-xml:1.7",
"org.apache.xmlgraphics:batik-anim:1.7",
"org.apache.xmlgraphics:batik-css:1.7",
"org.apache.xmlgraphics:batik-ext:1.7",
"org.apache.xmlgraphics:batik-js:1.7",
"org.apache.xmlgraphics:batik-parser:1.7",
"org.apache.xmlgraphics:batik-script:1.7",
"org.apache.xmlgraphics:xmlgraphics-commons:1.2",
"commons-logging:commons-logging:1.0.4",
"org.apache.avalon.framework:avalon-framework-api:4.3.1",
"org.apache.avalon.framework:avalon-framework-impl:4.3.1",
"xalan:xalan:2.6.0",
"xml-apis:xml-apis-ext:1.3.04"
){
transitive = false
Why I can't download? Invalid svg? I got this svg from wiki.
Check your deployed code on either the presence of batik-svg-dom-1.7.jar or batik-all-1.7.jar (using that would shorten your compile configuration considerably too). If it is missing, add it manually just to see if that fixes your issue. If it is missing however something is missing in your deploy configuration.
This is not a good/bad answer nor a fix, but it only runs at grails run-war, I don't know why and it works.

Can't find omnifaces.GenericEnumConverter after migrating to Tomcat 7 and MyFaces 2.2

For some reason after upgrading from Tomcat 6 -> Tomcat 7 and from MyFaces 2.0 -> MyFaces 2.2 (Using OmniFaces 1.7)
I began to get the following error
javax.faces.FacesException: Could not find any registered
converter-class by converterId : omnifaces.GenericEnumConverter
at org.apache.myfaces.application.ApplicationImpl.createConverter(ApplicationImpl.java:1533)
at org.omnifaces.application.OmniApplication.createConverter(OmniApplication.java:77)
at org.apache.myfaces.view.facelets.tag.jsf.ValueHolderRule$LiteralConverterMetadata.applyMetadata(ValueHolderRule.java:50)
at org.apache.myfaces.view.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:45)
at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:63)
at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:90)
at org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:290)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:50)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:55)
The only way that I can use the omnifaces.GenericEnumConverter right now is by adding it manually to the faces-config.xml , like this:
<converter>
<converter-id>omnifaces.GenericEnumConverter</converter-id>
<converter-class>org.omnifaces.converter.GenericEnumConverter</converter-class>
</converter>
Any ideas why? and how can I resolve it?
Thanks.
This will happen if you have
<faces-config ... metadata-complete="true">
in your webapp's /WEB-INF/faces-config.xml. This way JSF won't scan JARs for additional JSF artifacts such as #FacesConverter and so on.
Jsut remove the whole metadata-complete attribute, it defaults to false already.
Unrelated to the concrete problem, MyFaces 2.2 has internally already fixed the problem for which the OmniFaces GenericEnumConverter was been introduced as the solution. You can actually safely remove it from your code.

oauth2:custom-grant

I meet this problem when I import the source code of spring-security-OAuth2. I am not quite familiar with XML.
the wrong code is
<oauth2:authorization-server client-details-service-ref="clientDetails">
<oauth2:authorization-code />
<oauth2:custom-grant token-granter-ref="tokenGranter" />
</oauth2:authorization-server>
it reported
cvc-complex-type.2.4.a: Invalid content was found starting with element 'oauth2:custom-grant'. One of '{"http://www.springframework.org/schema/security/oauth2":implicit, "http:// www.springframework.org/schema/security/oauth2":refresh-token, "http://www.springframework.org/schema/security/oauth2":client-credentials, "http://www.springframework.org/schema/ security/oauth2":password}' is expected.
You are using an old version of Spring Security OAuth that does not support "custom-grant"

JSF 2 OpenJPA 2 Glassfish 3.1 WEB9031 Error

I got this error which according to Apache Support is an issue relating with Glassfish rather than OpenJPA:
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped
The stacktrace is:
Caused by: java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1410)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
at com.ckd.model.BookModel.pcNewObjectIdInstance(BookModel.java)
at org.apache.openjpa.enhance.PCRegistry.newObjectId(PCRegistry.java:138)
at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClass(MetaDataRepository.java:1693)
at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClasses(MetaDataRepository.java:1643)
... 112 more
Has anyone come across this before and how to resolve it? I have been stuck on this issue for the last several days.
Another of my post related to this issue can be found here: JSF 2: h:link and getrowdata.
The above error relates to a problem with the OpenJPA enhancer. When you execute Sun's JDK the OpenJPA's dynamic enhancer starts by default. This action, in turn, stuffs up Glassfish's classloader class - hence, the WEB9031 error.
For those who experience this same issue, a simple workaround is to do the enhancement at build time - which I did in ANT with org.apache.openjpa.ant.PCEnhancerTask - and add this property to your persistence.xml to shut off the dynamic enhancer: <property name="openjpa.DynamicEnhancementAgent" value="false"/>.
Also, it wouldn't hurt to throw this in your persistence.xml as well <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />.

Resources