java.lang.NoSuchMethodError: org.apache.tomcat.util.ExceptionUtils.unwrapInvocationTargetException - java

The code is not written by me, so I am not able to give proper input for question ;), but still want to know the cause of the exception in general. :)
I have installed OpenCRX CRM, and when I run, the following exception is thrown,
SEVERE: Begin event threw error
java.lang.NoSuchMethodError: org.apache.tomcat.util.ExceptionUtils.unwrapInvocationTargetException(Ljava/lang/Throwable;)Ljava/lang/Throwable;
at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:184)
at org.apache.catalina.core.AprLifecycleListener.isAprAvailable(AprLifecycleListener.java:83)
at org.apache.catalina.connector.Connector.setProtocol(Connector.java:592)
at org.apache.catalina.connector.Connector.(Connector.java:66)
at org.apache.catalina.startup.ConnectorCreateRule.begin(ConnectorCreateRule.java:62)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1282)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:507)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1323)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2750)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:828)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:757)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:133)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1211)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:551)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1543)
at org.apache.catalina.startup.Catalina.load(Catalina.java:615)
at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
java.lang.NoSuchMethodError: org.apache.tomcat.util.ExceptionUtils.unwrapInvocationTargetException(Ljava/lang/Throwable;)Ljava/lang/Throwable;
at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:184)
at org.apache.catalina.core.AprLifecycleListener.isAprAvailable(AprLifecycleListener.java:83)
at org.apache.catalina.connector.Connector.setProtocol(Connector.java:592)
at org.apache.catalina.connector.Connector.(Connector.java:66)
at org.apache.catalina.startup.ConnectorCreateRule.begin(ConnectorCreateRule.java:62)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1282)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:507)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1323)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2750)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:828)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:757)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:133)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1211)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:551)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1543)
at org.apache.catalina.startup.Catalina.load(Catalina.java:615)
at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
I would like to know when such a exception is thrown? What are the possible solutions should I try ?
Thank you :)

This may be because of library conflict. May be there will be an old library or conflicted (conflict with app libraries) library in tomcat lib folder. Try to force to use app libs

I can give only a hint. In my case I had changed the name from a propertie inside my maven properties. I got the same error and same behavior. The tomcat was able to start but the application was not able to boot up with spring boot. After renaming the tag to the old name the application was able to boot with spring boot and tomcat aswell.

Related

ClassDefNoFound even though the jar that I'm dependent on is in my jar

I'm writing a LabyMod addon to create a shop bot for minecraft clients.
I've well succeeded to do so, at least in my dev-environement in eclipse. Now I wanted to publish it, and to do this, LabyMod provides a possibility to use gradle for wrapping up all stuff that is relevant to the addon in the addon jar, that can then simply be dragged into the "addons"-Folder.
However, when I do this, the plugin didn't appear in the plugin overview, and I found out that there was an error when loading the plugin (Class def not found). I use okhttp3 to send some web requests to my verification server, so I just added it in eclipse as dependent jar, but they were not included when gradle built the jar. So I wasn't very surprised with that, and looked for a possibility to add my dependencies to the jar directly.
I found out in the commments of the predefined build.gradle to simply put all files in a predefined "libs"-folder which seemed to be fine. Here's the issue: Although the jars definitely are a part of the jar, the classdefnotfound-thing still happenes. Here's what I mean.
JD-GUI says of my jar:
So, the jars definitely are there, and jd-gui can find them in the code as well, since you can click on the imports and get taken to the place where okhttp3 defined the imported class.
Here's however the error that I get, when trying to load the addon:
catching
java.lang.NoClassDefFoundError: okhttp3/OkHttpClient$Builder
at borg.locutus.grieferbot.utils.NetworkUtilities.sendGet(NetworkUtilities.java:70)
at borg.locutus.grieferbot.utils.NetworkUtilities.getPermissionLevelOfPlayer(NetworkUtilities.java:51)
at borg.locutus.grieferbot.GrieferBOTAddon.initPermissionLevel(GrieferBOTAddon.java:50)
at borg.locutus.grieferbot.GrieferBOTAddon.onEnable(GrieferBOTAddon.java:43)
at net.labymod.addon.AddonLoader.enableAddon(AddonLoader.java:349)
at net.labymod.addon.AddonLoader.enableAddons(AddonLoader.java:309)
at net.labymod.main.LabyMod.init(LabyMod.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:560)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:737)
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:310)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:495)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:329)
at net.minecraft.client.main.Main.main(SourceFile:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Caused by: java.lang.ClassNotFoundException: okhttp3.OkHttpClient$Builder
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 44 more
Caused by: java.lang.NullPointerException
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:182)
... 46 more
How can I make my jar find the missing dependencies?
You can't just put the dependency jars into the main jar. You need to shade the dependencies into them.

java.io.IOException: Incorrect function while runing grails webapp on guest os

I have simple grails app, it works good at my system, but it is hard to share it with other people where everyone has some different settings so i thought it woudl be good to create vagrant box so everyone coudl run it on os with same settings. Ok so let get us down to the business on guest os i can run app also(app is in shared folder) but i recive errors
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Incorrect function.
at org.grails.io.watch.WatchServiceDirectoryWatcher.addWatchDirectory(WatchServiceDirectoryWatcher.java:183)
at org.grails.io.watch.WatchServiceDirectoryWatcher.addWatchDirectory(WatchServiceDirectoryWatcher.java:153)
at org.grails.io.watch.DirectoryWatcher.addWatchDirectory(DirectoryWatcher.java:111)
at grails.boot.GrailsApp.configureDirectoryWatcher(GrailsApp.groovy:299)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
at grails.boot.GrailsApp.enableDevelopmentModeWatch(GrailsApp.groovy:110)
at grails.boot.GrailsApp.run(GrailsApp.groovy:65)
at grails.boot.GrailsApp.run(GrailsApp.groovy:347)
at grails.boot.GrailsApp.run(GrailsApp.groovy:336)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at baseapp.Application.main(Application.groovy:8)
Caused by: java.io.IOException: Incorrect function.
at sun.nio.fs.WindowsWatchService$Poller.implRegister(WindowsWatchService.java:420)
at sun.nio.fs.AbstractPoller.processRequests(AbstractPoller.java:260)
at sun.nio.fs.WindowsWatchService$Poller.run(WindowsWatchService.java:580)
at java.lang.Thread.run(Thread.java:745)
I was trying to figure out what is wrong, so my only guess based on WatchServiceDirectoryWatch.java is that grails is trying to set some dir which it will be scanning(i dont know for what?) but because project is in shared folder grails is trying to set dir to which it does not have access(guessing). My question is what cant i do to do not recive that errors?
I think you should go deeper and look at grails.boot.GrailsApp at grails.boot.GrailsApp.configureDirectoryWatcher(GrailsApp.groovy:299) which
Creates and returns a file change listener for notifying the plugin manager of changes.
and then at grails.boot.GrailsApp.enableDevelopmentModeWatch(GrailsApp.groovy:110)
which is inside a function named enableDevelopmentModeWatch.

Java JPG codec won't work

I have problem with my tomcat application, after changing the server and installing the last version of tomcat7 my application won't read/load jpg files..
I installed imageio and jai on the server, try to change java version but every time I have the same error..
Anybody have an idea?
Error: One factory fails for the operation "jpeg"
Occurs in: javax.media.jai.ThreadSafeOperationRegistry
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179)
The whole error log can be found here -> http://paste.ubuntu.com/7653452/.
Update: The problem is related to grails plugin called ImageTools
If you look at the code for JPEGImageDecoder you'll see it depends on com.sun.image.codec.jpeg.ImageFormatException in its imports.
However, com.sun.image.codec.jpeg was removed from Java 7 onwards.
So likely the problem is that JAI is simply out of date, and you would have to use a Java 6 runtime to use it.

NoSuchMethodError: com.google.appengine.api.memcache.ErrorHandlers.getConsistentLogAndContinue

Why do I get this error when I try to access a "resource" in my web service:
java.lang.NoSuchMethodError: com.google.appengine.api.memcache.ErrorHandlers.getConsistentLogAndContinue(Ljava/util/logging/Level;)Lcom/google/appengine/api/memcache/LogAndContinueErrorHandler;
at com.googlecode.objectify.cache.EntityMemcache.<init>(EntityMemcache.java:178)
at com.googlecode.objectify.ObjectifyFactory.<init>(ObjectifyFactory.java:69)
at com.mycompany.mywebservice.core.daoimpl.OfyFactory.<init>(OfyFactory.java:41)
at com.mycompany.mywebservice.core.daoimpl.OfyService.<clinit>(OfyService.java:14)
at com.mycompany.mywebservice.rest.blob.serviceimpl.BlobServiceImpl.getBlobInfo(BlobServiceImpl.java:78)
at com.mycompany.mywebservice.rest.blob.BlobController.getBlob(BlobController.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
I'm using GAE version 1.7.4 and Objectify v 4.0a4
Here's where the error is thrown:
result = ofy().load().type(BlobInfo.class).filter("id", key).first().get();
Looks like there's a chance you have some old App Engine SDK jars in your classpath. Check your WEB-INF/lib folder and clean out any old app engine versions that might have somehow got there.
Looking here:
http://code.google.com/p/googleappengine/source/browse/trunk/java/src/main/com/google/appengine/api/memcache/ErrorHandlers.java?r=284
It seems the methods added since SDK 1.6.4.1 so chances are you have something older than that hanging around.
I'm not sure but I guess the Objectify you use is from after that. In any case 4.0a4 is not the most recent and it would be wise to update it.

Java compiling error netbeans

This is an error am getting when compiling my project on netbeans:
Exception while loading the app : java.lang.Exception: java.lang.IllegalStateException:
ContainerBase.addChild: start: org.apache.catalina.LifecycleException:
org.apache.catalina.LifecycleException: java.lang.ClassCastException:
core.smd.classes.FormData
cannot be cast to javax.servlet.Servlet
D:\Users\GHAMKS1C\Documents\NetBeansProjects\SMDApp\nbproject\build-impl.xml:728:
The module has not been deployed.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy
(Deployment.java:210)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
Any idea?
Thanks
The exception says core.smd.classes.FormData cannot be cast to javax.servlet.Servlet. So I presume you're using the FormData class somewhere where a Servlet should be used. Perhaps you have misconfigured your web.xml.
OK got it:
In netbeans under servlets, in the servlet class, I had a wrong value. The correct generic value that is there by default is:
javax.faces.webapp.FacesServlet
I had to recreate the project, but that's the only difference between new and old. Hence it is cause of problem.
Hope this helps someone in future :)

Categories