AnnotationActionValidatorManager - Caught exception while loading file java/lang/Object-validation.xml - java

Struts version of our application is 2.3.8. Getting following exception after every post back to the server.
Application is deployed on to WebSphere server. We don't have any validation xml in the project.
ERROR com.opensymphony.xwork2.validator.AnnotationActionValidatorManager - Caught exception while loading file java/lang/Object-validation.xml
java.lang.NullPointerException at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:391) at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildClassValidatorConfigs(AnnotationActionValidatorManager.java:279) at
com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:371) at
com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:350) at
com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:102) at
com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:141) at
com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:133) at
com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:128) at
com.opensymphony.xwork2.validator.ValidationInterceptor.doBeforeInvocation(ValidationInterceptor.java:222)

There seems to be a bug since Struts2 2.3.4 version. You can refer the JIRA. This bug has been fixed in 2.3.7 version. I would recommend you to verify that all your Struts2 libraries are properly updated and deployed with the correct version. Please try upgrading your Struts2 to higher version. The difference i see is that exception accurs with AnnotationActionValidatorManager in your case, where as in the bug list. it is DefaultActionValidatorManager on which loadFile() method is invoked

Struts2 always loads the validation.xml file present in xwork-version.jar. This might get this error,check it manually once.

Related

java.lang.NoSuchMethodError: org/jboss/logging/Logger.debug

While my application is being deployed to websphere 9 i get this error
Caused by: java.lang.NoSuchMethodError:
org/jboss/logging/Logger.debugf(Ljava/lang/String;I)V (loaded from
file:/C:/server/IBM/WebSphere90/AppServer/plugins/com.ibm.ws.cdi.logging.jar
It seems that the above jar is being loaded before jboss-logging-3.3.0.Final.jar used by hibernate.
At the same time i have a different machine on which this issue is not present.
com.ibm.ws.cdi.logging.jar is missing from the path and the error no longer occurs.
How to fix the error and why in one installation the cdi.logging.jar is present and in the not?
You could add jboss-logging-3.3.0.Final.jar as an isolated shared library and associate it with your application. That will cause it to be preferred over anything provided by the application server.
Since you have com.ibm.ws.cdi.logging.jar you must be on Websphere 9.0.0.0, I would suggest upgrading to Websphere 9.0.0.5 or later, your issue should be resolved by PI79787.
Best regards.

NoClassDefFoundError for com.sun.xml.internal.ws.fault.SOAPFaultBuilder

Our web service client in live environment recently got the exception:
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:107)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
at com.sun.proxy.$Proxy146.search(Unknown Source)
....
I've done a lot of search online, including a few posts here at StackOverflow:
Catching webservice exception with CXF: NoClassDefFoundError: SOAPFaultBuilder
Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
And my understanding was our client received a SOAP Fault from the server and it's missing some jar file. So I'm trying to solve the problem by first recreating it.
I created a simple Web Service server project in Eclipse which has a web method throws a simple fault class annotated by #WebFault. Then I created a simple Web Service client project which consumes the web method. The client project doesn't have any additional libraries/jars in its classpath; all it has is the JRE. To my surprise, it didn't throw the NoClassDefFoundError exception! Instead, I got the javax.xml.ws.soap.SOAPFaultException I defined on the server side.
The class SOAPFaultBuilder is indeed in rt.jar in JRE. So the simple web service projects I created probably just work as they should. However, how come the web service client in our live environment throw the NoClassDefFoundError exception? That project definitely has rt.jar in the classpath.
Can anyone please shed some light on this problem? If it's missing some jar files (either from the jaxws RI or Apache CXF or others), why would the super simple client I created didn't throw the error? Both the live environment and my local environment use Java7u51.
I have encountered the same problem and I could subsequently resolve this.
Due to the following error mentioned in the Problem, the underlying cause of the SOAP Fault could not be found.
I followed the steps mentioned in the following link, to identify the reason for NoClassDefFoundError.
http://javarevisited.blogspot.in/2011/06/noclassdeffounderror-exception-in.html
I could find the following errors in my application log:
java.lang.ExceptionInInitializerError
Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext
The reason for the above classcast exception is due to conflicting jar files.
rt.jar (this is present in jre classpath)
jaxb-impl-2.0.1.jar (this is present in my application classpath).
I have removed the file jaxb-impl-2.0.1.jar from my classpath and the actual error is gone.
I had the same erorr and I resolved this issue by deleting the jax-impl.jar from the tomcat lib folder. It was a possible conflict of the jaxb jar versions with one of my webapps installed in tomcat.
http://programtalk.com/java/i-was-running-gwt-application-on-tomca/

Spring websocket example - error - Are you running in a Servlet container that supports J SR-356?

I am trying to run the Spring 4 example given # https://spring.io/guides/gs/messaging-stomp-websocket. When I try to connect to socket, it throws me following exception. As per the example you need tomcat 7.0.50 and I checked the executable jar which has right version of tomcat. Any pointer would be helpful.
java.lang.IllegalArgumentException: No 'javax.websocket.server.ServerContainer' ServletContext attribute. Are you running in a Servlet container that supports JSR-356?
Check that you have tomcat7-websocket.jar and websocket-api.jar bundled in your executable jar - perhaps you're just getting vanilla tomcat without the extra websocket bits.
I got the same error message in another use case: I deactivated auto configuration and added WebSocketConfig manually to the configuration. Then I got the abovementioned error message.
Fixing the problem was easy: just adding WebSocketAutoConfiguration to the configuration.
I know that this is an ancient thread but I ran into this error and resolved it in modern times by adding implementation("org.springframework.boot:spring-boot-starter-tomcat") explicitly to my project.

Xerces ClassCastException in WebLogic

When we started using JPA in WebLogic 10.3.5, we noticed the following exception occasionally. About half of the time we would start the server any JPA call would result in the error, the other half of the time it was fine.
java.lang.ClassCastException: :
org.apache.xerces.parsers.StandardParserConfiguration cannot be cast
to org.apache.xerces.xni.parser.XMLParserConfiguration" occurred while
attempting to determine the version of "myPersistenceXmlFileHere.xml"
Inside our EAR is a xercesImpl jat used by other portions of the project (non-JPA) without issue. I suspect the problem is simply interference from the WebLogic implementation jar.
Update: (Re)deploying in Eclipse seems to reproduce this issue regardless of settings in answer below. Once the exception appears once, it will not resolve and the only solution is to restart the server instance.
In our weblogic-application.xml we added the following, through trial and error. We now do not have any ClassCastExceptions, as the local jar should be taking precedence in this scenario.
<wls:prefer-application-packages>
<wls:package-name>org.eclipse.persistence.*</wls:package-name>
<wls:package-name>org.apache.xerces.xni.parser.*</wls:package-name>
<wls:package-name>org.apache.xerces.parsers.*</wls:package-name>
<wls:package-name>org.apache.xalan.*</wls:package-name>
</wls:prefer-application-packages>

DWR invoke error in Javascript

I am using Spring 3.05 and DWR 3.0rc1 in my application for making AJAX calls. In local environment, i.e. Eclipse & Tomcat Server, it's working fine but in Clustered Environment I am getting the following errors while invoking DWR and a script error is coming saying DWR is not defined, but I am able to see myApplication/dwr/index.html properly.
Error Log:
Skipping 'script' due to NoClassDefFoundError on org.directwebremoting.create.ScriptedCreator. Cause: org/apache/bsf/BSFException
Skipping 'pageflow' due to ClassNotFoundException on org.directwebremoting.beehive.PageFlowCreator. Cause: Beehive/Weblogic jar file not available.
adding creator type: none = class org.directwebremoting.create.NullCreator
adding creator type: new = class org.directwebremoting.create.NewCreator
Please help me out
Looks to me that jars are not included in the classpath. Can you please check whether it is included?

Categories

Resources