I'm trying to convert JSON to XML and vise versa. For that I'm using staxon jar. I'm using below code to do that.
Source source = new StAXSource( reader );
Result result = new StAXResult( writer );
TransformerFactory.newInstance().newTransformer().transform( source, result );
If you notice in this TransformerFactory.newInstance() returns com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl for transform. This implementation is working fine in standalone as well as in Weblogic. But in WAS I'm getting ClassNotFoundException while executing this method.
I found the root cause for this, i'm using Websphere 8.5.5.0 internally it is starting with SDK1.6 in WAS installed folder. Inside SDK jre lib rt.jar com.sun.org.apache.xalan package is not there ??
To solve this problem i tried following ways but not achieved..
1. Trying to start WAS in normal JDK1.6 not starting giving some class notfound exception.
2. Create my own jar with all missing packages and put it into my project, on that time it is considering but XMLDocument state not START like exception I'm getting
How can I over come this problem?? Thanks
Related
I convert a java's class to dll using IKVM, by making a jar file for the this class and then I used IKVM to make the conversion operation. this operation is done successfully without errors or warnings. then I add the (DLL) with an 'IKVM.GNU.Classpath.dll' and 'IKVM.Runtime.dll' (DLLs) to my project. then I rebuilt the project, up to that point no errors, no warnings, no crashes happened. but when I tried to deserialized an arraylist of object from it is type, I get an exception is : java.lang.ClassNotFoundException: "MyClass" not found in java.lang.ClassLoader... my deserliazation. code is :
object deserializedObject = null;
java.io.ObjectInputStream ina = new java.io.ObjectInputStream(new java.io.FileInputStream(#"D:\130043674485690000.txt"));
deserializedObject = ina.readObject();
ina.close();
First: you should use the current version of IKVM for new projects. The file name show that you use a very old version of IKVM.
Second: you need to use all dlls from the IKVM. If all is working then you can remove some of the not used dlls.
Third: if you does reference the classes of your dll/jar file statically then you need load it dynamically. See the wiki for details.
I have old jaxb1 code that I am trying to run on JDK1.6(u 31).
It compiled fine. When I try to run I get the error -
Error constructing QTIResultsProcessingV12:Input is not a well formed document: Provider com.sun.xml.bind.ContextFactory_1_0_1 not found
So I tried to google and found that I have to place jaxb1_impl.jar in classpath.
I did not find this jar in jdk lib , so I downloaded JAXB RI 2.1.10 and put the jaxb1_impl.jar in classpath. Yet I get the same error.
Migrating jaxb1->jaxb2 is something not desired at this point as this is a short term solution.
hi i was referring the following document for Web-based spreadsheets with OpenOffice.org and Dojo
http://www.javaworld.com/javaworld/jw-05-2008/jw-05-spreadsheets.html?page=1
I am developing such thing for first time..
I created the java classes but when i compile the class 'SpreadsheetDoc.java' i get the following error :
com.sun.star.uno does not exists
I may be skipping some step by mistake dont know what.
tried setting the class path for openoffice/program folder but still getting problem
I am using apache tomcat 7.0, Open office 3, JDK 6.
How can i get the proper import for the namespace.
com.sun.star.uno
I think that it could be some problem related to
juh.jar
jurt.jar
ridl.jar
unoil.jar
reference but not sure...
Have you installed the OpenOffice SDK?
I am facing problems with using xalan in eclipse plugin.
When I try to create factory instance by:
TransformerFactory tFactory = TransformerFactory.newInstance("org.apache.xalan.processor.TransformerFactoryImpl", null);
I get error:
javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
...
I have following libs in plugin classpath: xml-apis.jar, xercesImpl.jar, serializer.jar, xalan.jar
I even can't create class instance by:
c = Class.forName("org.apache.xalan.processor.TransformerFactoryImpl");
Object o = c.newInstance();
It returns ClassNotFoundException
But I can create instances of other classes from same jar and can run same code outside eclipse without problem.
Any idea?
Edit: TransformerFactory instantiating class (say "class1") is part of an external library added in the plugin classpath wheras the xalan.jar is also in plugin classpath. If I move this "class1" into plugin, it finds the provider and works fine.
Though I have seen this problem once, but I am not very sure how i solved it.
If you are using JDK 1.5 or above then try removing xml-apis.jar. It was needed for Java 1.4 to support XML.
Update 1
Ok. From your question I inferred that you are writing a eclipse plug-in. If yes, then have you added the above jars using plugin.xml->Runtime->classpath? If not try to do so. Eclipse plugin considers only its runtime->classpath entries
Update 2
To me it still appears as a classpath resolution issue. Though, its hard to say why its happening. For a try you can also check by changing the order of included jars in plugin.xml->Runtime->classpath.
Hope this will help.
PS: Since you are working on eclipse plug-in development therefore I would suggest you to go through this article Eclipse - a tale of two VMs and many classloaders.
I keep getting the following exception on one of our live servers (the others running the same code seem ok):
java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/domwith the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom
at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:67)
I'm pretty sure that I have the Xalan and Saxon jars in the classpath (using IBM Java 1.5).
Do you have any Ideas what else could be wrong?
Edit:
That's the code that causes the Problem:
XPathFactory factory = XPathFactory.newInstance();
And it's running on a custom web server that's roughly based on the catalina engine.
You need to add the appropriate .jar in your classpath. In my case I used the Saxon-HE library.
There exists a bug in Saxon9 you maybe run into like me.
The bug has been corrected in version 9.5.1.5. So you may download the latest Saxon 9 HE.
Found the answer myself: The problem is the combination of using Java 5 and having an option
-Djava.endorsed.dirs
set to a directory that contained the xalan.jar.
Once removed everything works again.
Make sure you have the appropriate xml-apis.jar and xerces jars in your classpath for the version of xalan that you are using (check the release notes for what, exactly, you need).
Also make sure you don't have multiples as the xercesImpl.jar, xml-apis.jar and xalan.jar need to be in sync.