I am deploying one war file on WebLogic server (12.1.3.0.0) but when I try to start that application to serve all requests. It get failed with the following error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.web.method.annotation.ExceptionHandlerMethodResolver.hasExceptionMappings()Z .
The same war file is working fine on Windows platform and other Linux machines but I am getting that error on one particular Linux machine so my understanding is that there is something missing (e.g. some package) on this machine but I am unable to identify that what exactly.
It means "I cannot find the method hasExceptionMappings inside class org.springframework.web.method.annotation.ExceptionHandlerMethodResolver"
Please check if the spring jar version that the WebLogic using is different when you are compile the WAR. The spring library could be a shared library, you may check the classpath first.
FYI: https://docs.oracle.com/middleware/1212/wls/WLPRG/classloading.htm#WLPRG319
If this code works on other machines and is definitely an identical deployment, then the difference must be on the machine where you are deploying it. I agree you should check the versions of the Spring files that are provided on this server against those where it does run successfully. When you find a difference you will know what needs fixing.
Related
I have a spring-boot web application and today I deploy it to Linux system. My application uses HSM device so it use a library called jcryptoki to work with it.
My service is deployed and run well, but unfortunately, I am facing with below error when executing business function:
nested exception is java.lang.UnsatisfiedLinkError: no jcryptoki in java.library.path
here is the document that I referred to create a service.
When I run this app as normal by run command java -jar ... it's worked well.
I found the same error occur when missing the lib path declaration $LD_LIBRARY_PATH. Maybe when running application as a service, the system cannot be found this lib path.
I run both case as root account, have I lost anything in configuration or permission?
Finally, I found the problem caused by the missing Environment declaration variable on the service definition file.
With specific declaration variable: LD_LIBRARY_PATH=LD_LIBRARY_PATH=/opt/safenet/protecttoolkit5/cpsdk/lib/linux-x86_64/ I add new file named imported_inv (located in etc/default) with content as above. In the service defination file, I declare additional info like this
reload service and then it works like a charm.
The projet work fine in tomcat localhost but when I upload it in a remote tomcat I get this bug :/ , I have the jar that contain the ImageReaderFactory class in classpath, I didn't understand what can be the problem,
I cleared the /tomcat/work/Catalina/localhost folder but always the same bug : java.lang.NoClassDefFoundError
07-Oct-2019 23:06:25.584 SEVERE [http-apr-8080-exec-267] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [UploadServlet] in context with path [/MyServer] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoClassDefFoundError: org/dcm4che3/imageio/codec/ImageReaderFactory
at org.dcm4che3.imageio.plugins.dcm.DicomImageReader.setMetadata(DicomImageReader.java:794)
at org.dcm4che3.imageio.plugins.dcm.DicomImageReader.readMetadata(DicomImageReader.java:713)
at org.dcm4che3.imageio.plugins.dcm.DicomImageReader.read(DicomImageReader.java:452)
at com.project.dicomserver.UploadServlet.getFrameIcon(UploadServlet.java:86)
....
Does anyone have any ideas?
image
There is a bunch of things that could be go wrong in your specific case. So answering with the best of my knowledge. Make amendments, by adding as much details as possible, to the question and we can help you further.
Every application in tomcat needs to have a specific folder structure. The folder structure is documented here. In short, war files must be deployed into $CATALINA_BASE/webapps/ directory.
So if your application is "myapp", then there must be a $CATALINA_BASE/webapps/myapp directory.
Inside $CATALINA_BASE/webapps/myapp directory, we need to have WEB-INF. Not $CATALINA_BASE/webapps/myapp/WebContent/WEB-INF, but $CATALINA_BASE/webapps/myapp/WEB-INF ! And the case matters.
If this is not how your application is deployed into a vanilla tomcat, it will not work properly. Read the official documentation
Now about your development environment, see whether your eclipse configurations have been modified. The Export As War options can be modified at multiple locations and all of them can have impact on the war file you have generated. When in doubt, I look at this link
Use a build tool like maven or gradle. These tools bring standards for compiling, archiving, testing and deploying applications and makes you worry less on environment related issues.
DataNucleus has a Java agent that performs bytecode enhancement of classes. I added -javaagent:datanucleus-core-5.1.0-m3.jar=-api=JDO (Using the actual jar name and path) to the JVM options used by my IDE to start Tomcat. The agent threw org.datanucleus.exceptions.NucleusUserException: Error : Could not find API definition for name "JDO". Perhaps you dont have the requisite datanucleus-api-XXX jar in the CLASSPATH?, at which point I added -cp datanucleus-api-jdo-5.1.0-m3.jar:. (again using the actual jar name and path), which did not resolve the error. I understand that Tomcat has quirky classpath handling, but the Java agent should be running before Tomcat's main method, meaning none of this trickery should have happened yet. How do I perform runtime bytecode enhancement with DataNucleus on Tomcat?
I am using axis2 on Apache Tomcat. I am writing client side to consumer SOAP WS. I configured Eclipse to use Tomcat as a server and while executing that line
stub._getServiceClient().engageModule("addressing");
I was getting that error "unable to engage module addressing". To fix that issue I add following line in the VM arguments of run configuration
-Daxis2.repo="E:\axis2\repository"
Now I export my project as a war file and deploy it on the real server. But Now I am again getting the same error(I checked the log file). I don't know how to fix, can every one help me. Thanks
It got resolved on my side in the following way:
I had an outdated WEB-INF/modules/axis2-jaxws-mar*.mar or rather 2 versions of it and the classloader got the older one of it and AxisServlet didn't start altogether
java.lang.NoSuchMethodError: org.apache.axis2.engine.AxisConfiguration.getGlobalModules()Ljava/util/List;
at org.apache.axis2.jaxws.module.JAXWSModule.registerGlobalModule(JAXWSModule.java:51)
While running the application I was getting the following errors.
java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis2.description.AxisService
AxisService class is in axis2-kernel-1.6.2.jar file. Some of the classes from this jar are working fine without any issues, but some classes are throwing NoClassDefFoundError from this jar file at runtime. AxisService class is present in axis2-kernel-1.6.2.jar, even it throws error.
This is working fine in local machine. But error getting in Oracle r12 server.I have already set the class path for the jar file.
I am Using Java version is 1.6 and Apache axis2.1.6.2.
Had the same issue. I had included only jars that I needed to compile the application.
When I included everything from \axis2-1.6.2\lib\ folder, this exception were gone.
I had a similar problem using Tomcat and Axis2 and after a week finding out the error I realized there was a axis configuration problem. especifically my aplication can't instantiate the class which accedded to persistence layer. I include this parameter line:
<parameter name="ServiceTCCL">composite</parameter>
in services.xml file which is used by axis2 to work.
For more information see the comments in http://wso2.com/node/1131