DWR invoke error in Javascript - java

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?

Related

IllegalStateException: Implementation not found when trying to obtain a class

I've deployed an application(EAR) on IBM WebSphere succesffully. When I hit the URL - "https://WAS-External-IP:PORT/ProjectName/OtherInfo/ServletName, I get the error:
Error 404: javax.servlet.UnavailableException: SRVE0200E: Servlet [ServletName]: Could not find required class - class ServletName : javax.servlet.ServletException: Project's Exception: com.sun.crypto.provider.SealedObjectForKeyProtector
From the post - identify whether is code running on app engine runtime (Java)
I figure that GAE runtime 1.9.23 has the fix for runtime whitelisting, which omitted one or more classes needed to load the JCEKS key store. However, I can't figure out where can I find the GAE runtime version in my WebSphere.
When the same code is run when Application is installed on a Windows box, I don't get this error.
When I looked at the trace logs, I get the error:
Caused by: java.lang.IllegalStateException: No implementation could be
SystemErr R at jarName.classname.methodName(className.java:LineNumber)
From debugging, I see the class-name string is not loaded in the classpath. However, when I checked the jars available in the path mentioned in the classpath, I can see the JAR is present there. The JAR is also present in the pom file of the project.
I'm not able to set debug points at static blocks of missing class to see what is going wrong.
Windows and Linux often return list of files in different order, which can lead to jars being added to the classpath in a different order. How can I make Linux read the missing JAR in the classpath the way Windows does?

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.

Axis2 WS consumer in WebMethods8.2

I've got into a scenario where I have to get an Axis2 based ws consumer working within WebMethods as a java service. I've implemented the ws consumer first in netbeans just to see if it works and thus i found that the minimal amount of jars I'll require are the following:
[ xmlschema-1.4.7.jar, apache-mime4j-core-0.7.2.jar,
axiom-api-1.2.13.jar, axiom-impl-1.2.13.jar, axis2-adb-1.6.2.jar,
axis2-kernel-1.6.2.jar, axis2-transport-http-1.6.2.jar,
axis2-transport-local-1.6.2.jar, commons-codec-1.3.jar,
commons-httpclient-3.1.jar, commons-logging-1.1.1.jar,
httpcore-4.0.jar, mail-1.4.jar, neethi-3.0.2.jar, wsdl4j-1.6.2.jar ]
I've uploaded these jar files under the IS/packages/{package_name}/code/jars folder. Whenever I try to execute the java service that would send the request and process the response I get the following exception:
java.lang.reflect.InvocationTargetException:
org.apache.axiom.om.OMFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;
From the IS error log file I found that the actual error message is as follows:
org.apache.axiom.om.OMFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;
Caused by: java.lang.reflect.InvocationTargetException: null Caused
by:
java.lang.NoSuchMethodError:org.apache.axiom.om.OMFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory;
The platform is WebMethods 8.2 under Linux environment. The JDK version is 1.6.0_32 and the application server under WebMethods is Jetty.
Actually the solve of this problem was a bit more tricky. First of all I manually had to configure the manifest file of the package on the IS server to use the jars provided in the package abnd thus it wouldn't get in conflict with the Axis used by the IS itself. On the other hand I had to manually add the ClassLoader because WebMethods can't use META-INF based information from jar files as it seems. To solve this problem simply use:
System.setProperty("org.apache.axiom.om.OMMetaFactory", "org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory");
That solves all the problems.

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

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.

Categories

Resources