Results 1 to 5 of 5
  1. #1
    SharkDentist is offline Member
    Join Date
    Dec 2011
    Location
    Memphis, TN
    Posts
    6
    Rep Power
    0

    Default 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:

    1. I am not using the class loader correctly although I have used it this way before.
    2. Java is trying to use some facility built-in to Linux I don't have
    3. My jdk is not configured properly
    4. The parameters to newInstance() are wrong.
    5. 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






  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,050
    Rep Power
    20

    Default 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.

  3. #3
    SharkDentist is offline Member
    Join Date
    Dec 2011
    Location
    Memphis, TN
    Posts
    6
    Rep Power
    0

    Default 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

  4. #4
    SharkDentist is offline Member
    Join Date
    Dec 2011
    Location
    Memphis, TN
    Posts
    6
    Rep Power
    0

    Red face 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).

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,050
    Rep Power
    20

    Default 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

  1. Replies: 3
    Last Post: 12-09-2011, 03:51 AM
  2. Could not find or load main class BubbleSort.class
    By blaqkout in forum New To Java
    Replies: 5
    Last Post: 09-12-2011, 07:54 PM
  3. Replies: 3
    Last Post: 07-27-2011, 01:07 PM
  4. Problem with Cipher class in javax.crypto
    By vinayak.top in forum Advanced Java
    Replies: 4
    Last Post: 02-25-2011, 09:11 AM
  5. how to load a java class in startup
    By leonard in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 03:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •