Method not found for Jackson - java

I am trying to start my webapp to WAS 8 and I am seeing the following error....
Caused by: java.lang.NoSuchMethodError: org/codehaus/jackson/map/ObjectMapper.setPropertyNamingStrategy(Lorg/codehaus/jackson/map/PropertyNamingStrategy;)Lorg/codehaus/jackson/map/ObjectMapper;
at org.springframework.social.facebook.web.SignedRequestDecoder.<init>(SignedRequestDecoder.java:49)
at org.springframework.social.facebook.web.CanvasSignInController.<init>(CanvasSignInController.java:79)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
... 41 more
From what I have read this is a conflict between versions of Jackson, however, all of my versions appear to be 1.9.9 and the javadocs say that method should exist.
Can anyone help? I am using maven so it could be a dependency chaining issue.
UPDATE
Here are the dependencies in my WEB-INF/lib
https://gist.github.com/jrgleason/7932960

The issue with this was a missing XML file in my case. So if anyone gets this weird warning it looks like a missing XML file is causing an initialization error that is not propagated very well.
The file (for me) was...
WEB-INF\classes\META-INF\spring\backbase-portal-business-security.xml

Related

ClassNotFoundException: com.azure.storage.common.policy.RequestRetryOptions

I am trying to run a java program that sends and receives messages to and from Azure Storage Queues; however, I keep getting the following ClassNotFoundException at runtime. I am having a hard time finding the jars necessary to fix it. Nothing I have found so far actually solves the problem.
Exception in thread "main" java.lang.NoClassDefFoundError: com/azure/storage/common/policy/RequestRetryOptions
at com.azure.storage.queue.QueueServiceClientBuilder.<init>(QueueServiceClientBuilder.java:83)
at com.cloudproject.azure.Connector.initiateConnection(Connector.java:58)
at com.cloudproject.server.ConnectionServer.main(ConnectionServer.java:30)
Caused by: java.lang.ClassNotFoundException: com.azure.storage.common.policy.RequestRetryOptions
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 3 more
I am not using maven in the build process, though I have pulled several jars from the maven repository - none of which have helped.
This seems to have been fixed by including the azure-storage-common jar, which I pulled from here. Not sure how I overlooked this one earlier.

XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sE130CAA0A01A7CDE5A2B4FEB8B311707/index.xsb

I am writing an aplication to export data to an Excel sheet.
I wont to use the XSSFWorkbook class because my Excel exceeds the limit of 255 column of HSSFWorkbook class.
I downloaded the Apache POI libraries and I included the folowing libraries to my proyect:
- poi-3.9.jar
- poi-excelant-3.9.jar
- poi-ooxml-3.9.jar
- poi-ooxml-schemas-3.9.jar
- poi-scratchpad-3.9.jar
- dom4j-1.6.1.jar
- stax-api-1.0.1.jar
- xmlbeans-2.3.0.jar
When I export the data to get the Excel sheet I get this runtime error:
java.lang.ExceptionInInitializerError
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918)
at java.lang.reflect.Field.getFieldAccessor(Field.java:899)
Truncated. see log file for complete stacktrace
Caused By: java.lang.RuntimeException: Could not instantiate SchemaTypeSystemImpl (java.lang.reflect.InvocationTargetException): is the version of xbean.jar correct?
at schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder.loadTypeSystem(Unknown Source)
at schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder.<clinit>(Unknown Source)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
Truncated. see log file for complete stacktrace
Caused By: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder.loadTypeSystem(Unknown Source)
Truncated. see log file for complete stacktrace
Caused By: org.apache.xmlbeans.SchemaTypeLoaderException: XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sE130CAA0A01A7CDE5A2B4FEB8B311707/index.xsb (schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.index) - code 0
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.<init>(SchemaTypeSystemImpl.java:1519)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.initFromHeader(SchemaTypeSystemImpl.java:273)
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl.<init>(SchemaTypeSystemImpl.java:185)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
Truncated. see log file for complete stacktrace
I read in a post that cant be because of the version of xbean-xx.jar and I notice that I don't have this library, I included in my project the version xbean-2.3.jar and has not change anything.
I read in another post of stackoverflow other solution: xmlbeans could not locate schema resource when repacking xml beans jar into my own jar . I don't know if I understood the solution correctly but the file /schemaorg_apache_xmlbeans/system/sE130CAA0A01A7CDE5A2B4FEB8B311707/index.xsb is in the jar poi-ooxml-schemas-3.9.jar so I figured that this is not my problem.
Can anyone help me please? thanks.
I've spotted your problem
The key line of the exception is this:
XML-BEANS compiled schema: Could not locate compiled schema resource schemaorg_apache_xmlbeans/system/sE130CAA0A01A7CDE5A2B4FEB8B311707/index.xsb
Next up, we see your rather non-standard way of including all the jars (which isn't usually recommended, including for reasons like this), and we see these lines:
<zipfileset src="../lib/poi-ooxml-3.10-FINAL-20140208.jar" includes="**/*.class, **/*.properties, **/*.txt" />
<zipfileset src="../lib/ooxml-schemas-1.1.jar" includes="**/*.class, **/*.properties" />
You are explicitly only pulling in certain kinds of files, and excluding all others from those jars. Look at the extension of the missing file in the exception - .xsb. Look at your explicit include list. See what you've missed?
You should either re-visit your whole way of building jars to pick something more "normal", or make sure you actually include all the relevant parts of the jars you're inlining, such as the .xsb files that the exception states you need

org/dom4j/DocumentException

Good morning every body ,
I have java code that alllows me to create an excel file from xml flie.. But it can not create correctly the file, i have this exception that I do not inderstand its meaning :
Exception in thread "main" java.lang.NoClassDefFoundError: org/dom4j/DocumentException
at org.apache.poi.openxml4j.opc.Package.init(Package.java:145)
at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:132)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:67)
at org.apache.poi.openxml4j.opc.Package.create(Package.java:271)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:245)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:145)
at escel1.Escel1.main(Escel1.java:104)
Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
If someone knows what that means , it will be very helpfull for me :)
I have found the key about your problem. you shouldn't add the jar file of dom4j-1.6.1-sources.jar but dom4j-1.x.jar into the project library. Because the jar file's name with sources is pure java file(xx.java), that means it's not compiled at all.
then rebuild your project, it'll work fine.
Hope to help you :)
Apache POI have a handy page listing all the components and their dependencies, you should start by reading that!
Secondly, if you downloaded the binary zip/tarball of Apache POI, then it comes with all of the dependencies you need in the /lib/ and /ooxml-lib/ directories. Make sure you include all the dependencies required from there on your classpath! (You've missed some out, hence the error)

Runtime exception - Datanucleus enhancer

In order to trigger the Datanucleus enhancer, I needed to do a dummy modify the Persistable class/Entity then save it again.
However when triggered, throws/logs this error:
java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: 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:601)
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
... 2 more
Caused by: java.lang.NoSuchMethodError: org.datanucleus.plugin.PluginManager.<init>(Lorg/datanucleus/PersistenceConfiguration;Lorg/datanucleus/ClassLoaderResolver;)V
at org.datanucleus.OMFContext.<init>(OMFContext.java:159)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:172)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:150)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)
... 7 more
Although the datanucleus-enhancer-3.0.1 is in the Maven classpath and also in the WEB-INF/folder.
What can be causing this error if not missing libraries?
Do you believe everything you read on the internet? What has jasper-compiler got to do with DataNucleus enhancement? Answer : nothing. That post was about some method missing from some Jasper class ... which you don't have.
You simply are using inconsistent versions of "datanucleus-enhancer" and "datanucleus-core". If you were using Maven you wouldn't have the issue, but since you aren't you can see easily enough here that if using datanucleus-enhancer 3.0.1 then you need datanucleus-core 3.0.x also. After all that is what NoSuchMethodError implies also ... some thing is not present in the CLASSPATH. The packaged DataNucleus zip distributions always provide ALL consistent files, so you haven't used one of those either

GAE , Some Exception after upgrade datanucleus jar packages

When I changed the sdk orm jar to v2 (default including by sdk),I got some excepion info.It's about the datanucleus-core-3.0.6.jar has ben registed bla bla....
After search,I knew it was a bug in 3.0.6. So, I relpace it by datanucleus-core-3.0.10.jar.
But it not success when compile the pojo Enhancer
java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
... 2 more
Caused by: java.lang.NoSuchMethodError: org.datanucleus.plugin.PluginManager.<init>(Lorg/datanucleus/PersistenceConfiguration;Lorg/datanucleus/ClassLoaderResolver;)V
at org.datanucleus.OMFContext.<init>(OMFContext.java:159)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:172)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:150)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)
... 7 more
this is my jar file in the \lib\user\orm
asm-3.3.1.jar
datanucleus-api-jdo-3.0.5.jar
datanucleus-api-jpa-3.0.6.jar
datanucleus-appengine-2.0.0-final.jar
datanucleus-core-3.0.10.jar
geronimo-jpa_2.0_spec-1.0.jar
jdo-api-3.0.jar
transaction-api-1.1.jar
I has been looking for all day. Does any know what problem with it?
You have old versions of datanucleus-core and datanucleus-enhancer in the CLASSPATH somewhere. "OMFContext" from that stack trace hasn't existed in DataNucleus for a very long time.
I think I know, why it does not work to upgrade the appengine with a new datanucleus. It is not a classpath entry! I discovered that in the ant-macro.xml, which triggers the enhancing-step, there is a link to the appengine-tools-api.jar and there is the class EnhancerTask. This is probably a link to the old version since the new datanucleus-enhancer-3.0.1.jar has it's own EnhancerTask class. So the only way to use the new versions of datanucleus with the old appengine sdk (in contrary to http://code.google.com/p/datanucleus-appengine/wiki/HowToUpdateTheSDKWithANewPluginVersion) is to do the enhancement-step by either ant (https://developers.google.com/web-toolkit/doc/1.6/tutorial/appengine) or probably the eclipse-datanucleus-plugin. Unfortunately this plugin does not work properly in my Eclipse. After install/configure the plugin there is still no project-context menu "datanucleus", where I am supposed to add the support. So I'll try the ant version.

Categories

Resources