Results 1 to 5 of 5
- 01-11-2012, 12:32 AM #1
Member
- Join Date
- Dec 2011
- Location
- Memphis, TN
- Posts
- 6
- Rep Power
- 0
Problem: javax.xml.transform.FactoryFinder cannot load class
This problem is actually related to a problem I ran into while installing Websphere Community Edition. I wrote a test class to confirm my suspicions to simulate the problem. My test class creates the same error message as wasce startup. By the way, I downloaded the big bundle for wasce and the problem went away ???
I have been using Netbeans 7.0 for 6 weeks on Linux FC14 using jdk1.6.0_29 and it all works great.
The following code will not work even though saxon.jar is in my class path and I have verified it contains the class net.cf.saxon.TransformerFactoryImpl.
public class DebugWasce {public DebugWasce() {Classloader loader = DebugWasce.class.getClassLoader();
try {TransformerFactory tf = TransformerFactoroy.newInstance("net.cf.saxon.Tran sformerFactoryImpl", loader);} catch (TransformerFactoryConfigurationError tce) {System.out.println(tce.getMessage());}}}
The message I get is: Provider net.cf.saxon.TransformerFactoryImpl not found
If I use the following line instead, it works OK. I turned on jaxp.debug and I can see it do fallback lookup and I am using the java.endorsed.dirs to make it load from saxon.jar. When I use it as above, I don't see any debug output.
TransformerFactory tf = TransformerFactory.newInstance();
I looked at source code and newInstance(string,ClassLoader) is designed to not do any fallback lookup. I would really like to understand this so I don't have to tear my hair out next time because I anticipate using XML a lot or packages that use it. The possible explanations are:
- I am not using the class loader correctly although I have used it this way before.
- Java is trying to use some facility built-in to Linux I don't have
- My jdk is not configured properly
- The parameters to newInstance() are wrong.
- It is an ignored bug because most people use other methods to specify an XML parser instead of hard coding it.
Please advise or refer. Thanks in advance
- 01-11-2012, 09:51 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,458
- Rep Power
- 16
Re: Problem: javax.xml.transform.FactoryFinder cannot load class
Are you sure that the jar fiel for that class is on the runtime classpath for your app?
How are you defining that?
Anyway, normally you would define this as a property of some sort, as per the API. That would allow for use of the fallback.
- 01-18-2012, 04:51 PM #3
Member
- Join Date
- Dec 2011
- Location
- Memphis, TN
- Posts
- 6
- Rep Power
- 0
Re: Problem: javax.xml.transform.FactoryFinder cannot load class
It sounds like it needs a properties file in the jar manifest.
I will try that out.
So many APIs, so little time.Last edited by SharkDentist; 01-18-2012 at 05:24 PM. Reason: error
- 01-18-2012, 08:22 PM #4
Member
- Join Date
- Dec 2011
- Location
- Memphis, TN
- Posts
- 6
- Rep Power
- 0
Re: Problem: javax.xml.transform.FactoryFinder cannot load class
The solution to this problem was to put saxon9he.jar into $JAVA_HOME/jre/lib/ext plus it would help if I spelled the class name right.
Actually, a cleaner solution is:
import net.sf.saxon.*;
TransformerFactory tf = new TransformerFactoryImpl();
The problem is that putting saxon9he.jar in the CLASSPATH does not work (at least for me).
- 01-19-2012, 09:27 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,458
- Rep Power
- 16
Re: Problem: javax.xml.transform.FactoryFinder cannot load class
No.
That is not the solution.
You should not be putting anything in the jre directories.
You should also not use the CLASSPATH environment.
You should define the classpath for your particular app, either with -cp (for non-executable jar applications) or in the Manifest of the executable jar.
Anything else is pretty much a hack.
Similar Threads
-
Please help! Cannot find or load main class error
By BenH in forum New To JavaReplies: 3Last Post: 12-09-2011, 03:51 AM -
Could not find or load main class BubbleSort.class
By blaqkout in forum New To JavaReplies: 5Last Post: 09-12-2011, 07:54 PM -
"javax.xml.transform.TransformerException: Could not find function: matches" help!
By omripe in forum XMLReplies: 3Last Post: 07-27-2011, 01:07 PM -
Problem with Cipher class in javax.crypto
By vinayak.top in forum Advanced JavaReplies: 4Last Post: 02-25-2011, 09:11 AM -
how to load a java class in startup
By leonard in forum Advanced JavaReplies: 1Last Post: 08-06-2007, 03:36 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks