Multiversion config - saxparser re META-INF service provider

I have a problem with the configuration for an applet when using the SAXParser and support for browsers using JDK 1.4.2 and JDK 1.5 in specification of which SAXPaser implementation classes to use.
We had specified in the META-INF/services directory the implementation classes used for the SAXParser.
serviceprovides config file javax.xml.parsers.SAXParser contains org.apache.crimson.jaxp.SAXParserImpl
and
File javax.xml.parsers.SAXParserFactory contains org.apache.crimson.jaxp.SAXParserFactoryImpl
However in JDK 1.5 the SAXParser is now in a different package namely,
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
and similar for the SAXPaserFactory.
We don't have access to client browser JRE configuration only server side.
Would appreciate if anyone has any ideas how to provide this configuration for multiple Java client versions
This was all necessary to stop the classloader search mechanism from hitting the web server with class requests and causing 404 errors.
Thanks

I had a similar problem and solved it like this :
//  get version number
String strVersion = System.getProperty("java.specification.version");
// it's it version 1.5.x or not?
if (strVersion != null && strVersion.startsWith("1.5"))
    // set version 1.5.x specific values
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
    System.setProperty("javax.xml.parsers.SAXParserFactory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
    //org.apache.axis.utils.XMLUtils.initSAXFactory("com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl", false, false);
else
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.crimson.jaxp.DocumentBuilderFactoryImpl");
    System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.crimson.jaxp.SAXParserFactoryImpl");
    //org.apache.axis.utils.XMLUtils.initSAXFactory("org.apache.crimson.jaxp.SAXParserFactoryImpl", false, false);
}petter

Similar Messages

  • Calling webservice - meta-inf/services/javax.xml.ws.spi.provider not found

    Hi,
    I have created an applet. Its running well in standalone application. But it is not getting referred in some other localhost. The JAXWS is not getting referred by the JRE. I'm getting the exception as invocation exception, and cannot find the META-INF/services/javax.xml.ws.spi.provider.
    Anyone can solve, pls reply me.

    your problem is too stuffed to understand properly..could you elobarate a lil bit

  • Oracle.adf.share.config.ADFConfigFactory No META-INF/adf-config.xml found

    I just install jdeveloper10.1.3.3.0 4157, and test ,When I run test ,
    display:"oracle.adf.share.config.ADFConfigFactory No META-INF/adf-config.xml found
    Please help me how to solve this problem!

    Just now I test jdeveloper 11g 4 preview
    test project display log:
    2008-6-15 22:38:14 oracle.security.jps.internal.config.xml.XmlConfigurationFactory handleLocation
    警告: [XmlConfigurationFactory.handleLocation] Exception occurred when handling origLocation=/D:/jdevstudio11114949/j2ee/home/config/system-jazn-data.xml : no protocol: /D:/jdevstudio11114949/j2ee/home/config/system-jazn-data.xml
    2008-6-15 22:38:14 oracle.security.jps.internal.config.xml.XmlConfigurationFactory handleLocation
    警告: [XmlConfigurationFactory.handleLocation] Exception occurred when handling origLocation=/D:/jdevstudio11114949/j2ee/home/config/system-jazn-data.xml : no protocol: /D:/jdevstudio11114949/j2ee/home/config/system-jazn-data.xml
    [JpsAuth] For permisson ( CredentialAccessPermission credstore.provider.credstore.ADF.anonymous#HR001 read), domain that failed: ProtectionDomain cs(file:/D:/jdevstudio11114949/BC4J/lib/adf-share-support.jar), []
    BC4J Tester exit code(0)
    Message was edited by:
    user616170

  • META-INF/context.xml, Tomcat, META-INF/services

    I presently have a Netbeans project laid out like this:
    src
    src\java
    web
    web\META-INF
    web\META-INF\context.xml
    etc. Tomcat finds that META-INF/context.xml OK and does what I expect with it.
    I have recently added something that is loaded by java.util.ServiceLoader, which requires a META-INF/services/x.y.z file containing the name(s) of the classes that implement x.y.z. After deployment, my webapp's ServiceLoader doesn't find it, because in the target it isn't in WEB-INF/classes/META-INF/services/x.y.z. If I put it into src/java/META-INF/services/x.y.z it works correctly, as it then ends up in the right place. However I'm now concerned that either Tomcat won't find the context.xml if I put it in the same place under src, because it would then not be in /META-INF/context.xml but rather /WEB-INF/classes/META-INF/context.xml, which in turn would mean that I would then need two META-INF directories. I'm about to test that conjecture about Tomcat finding it under WEB-INF/classes/META-INF, but I'm wondering whether I'm doing something basically wrong in the first place here.

    You seem to think that you can have only one META-INF directory; this is simply not true. Keep both your META-INF directories and put the files where they are expected. Yay for using overlapping names :/

  • Contents of META-INF/services/javax.xml.parsers.DocumentBuilderFactory?

    I am currently working on an applet that solves Sudoku puzzles, allowing you to build your own in a Constructor and then solve them in a seperate Solver. To do this, we are implementing the puzzles files as XML documents.
    I have the code completely complied and on the server ( [sudoku.unl.edu|sudoku.unl.edu]) and it runs NEARLY perfectly, however when trying to access the server to save the xml code, the apache error_log presents this message: "File does not exist: classes/META-INF/services
    /javax.xml.parsers.DocumentBuilderFactory"
    Looking at the Java Doc here it says that the program should look for that in the jars. I am unsure of exactly how the applet is interacting with the server, but typing "java -version" yields:
    java version "1.6.0_11"
    Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 11.0-b16, mixed mode)Notably, the code works PERFECTLY in NetBeans, contacting the server using SCP and uploading the file and such, so the code doesn't seem to be the problem, unless I need to direct the DocumentBuilder code somehow. This is the code that I believe is causing the trouble (I have tried to include all relevant imports that are in my code):
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    DocumentBuilderFactory factoryBuilder;
              DocumentBuilder builder;
              Document doc;
              Element docElement;
              try
                   factoryBuilder  = DocumentBuilderFactory.newInstance( );
                   builder = factoryBuilder.newDocumentBuilder();
                   doc = builder.parse( indexLocation );
                   docElement = doc.getDocumentElement();
                   NodeList children = docElement.getChildNodes();          
                   for(int i =0; i < children.getLength(); i++)
                        if(children.item(i).getNodeType() == 1)
                             if((children.item(i).getNodeName()).equals("directory"))
                                  if ((children.item(i).getAttributes().getNamedItem("name").getNodeValue()).equals("UsersInput")) {
                                       Node firstChild = findNodeItem(children.item(i), "Difficulty0.." + this.upperField.getText());
                                       Node secondChild = findNodeItem(firstChild, "Level" + this.levelField.getText());
                                       Node thirdChild = findNodeItem(secondChild, (String)suTypeList.getSelectedItem());
                                       Element newFile = doc.createElement("file");
                                       newFile.setAttribute("name", fileName);                              
                                       thirdChild.appendChild(newFile);                              
                   SshParameters params = new SshParameters("cse.unl.edu", "consystlab","A/tutti");
                // create new Scp instance
                Scp scp = new Scp(params);
                // register event listener
                scp.addListener(this);
                // establish connection
                scp.connect();
                   TransformerFactory tFactory = TransformerFactory.newInstance();
                   Transformer transformer = tFactory.newTransformer();
                   DOMSource source = new DOMSource(doc);
                   StringWriter sw=new StringWriter();
                   StreamResult result = new StreamResult(sw);
                   transformer.transform(source, result);
                   String xmlString=sw.toString();
                // upload file
                  scp.upload(xmlString.getBytes(), indexPath, "libraryIndex.xml");
                 // disconnect
                scp.disconnect();
              catch (IOException e)
                   System.out.println("IO ERROR7");
                   System.out.println(e);
              catch (TransformerException tranE){
                   tranE.printStackTrace();               
              catch (ParserConfigurationException e)
                   System.out.println("IO ERROR8");
                   System.out.println(e);
              catch (SAXException e)
                   System.out.println("IO ERROR9");
                   System.out.println(e);
              }So my question is, what exactly are the contents of the file in the META-INF/services folder? I have manually created this file in my classes directory, where the program is searching. When I place text in it, it appends the text with .class and searches for that file, but doesn't seem to do anything with the file. I attempted directing it to the "DocumentBuilderFactory.class" file that I extracted from the classes.jar included with the JDK.
    I feel like all I need is this file to contain the correct content and the code will FINALLY work, but I have not been able to find anything out there on it.
    Thank for you for your help, sorry this was such a long message.
    -Jason

    Thanks!
    Thanks for the fast reply. I don't know if I made my point clear.
    I do not want to determine the parser by myself. I want the client system use the default parser, so I do not have the hit of downloading the fairly large parser jar.
    However, I want it not to do an empty request to the server for nothing. This turn around time kills an Applet. I want a fast loading applet!
    I'll go in trial and error mode, when I find the time next week.
    Thanks again, I appreciate it!
    K<o>

  • Format of  "META-INF/services/javax.xml.parsers.SAXParserFactory"

    Hi there,
    I have written an applet utilizing JAXP. Now the applet does hit the server with requests to
    "META-INF/services/javax.xml.parsers.SAXParserFactory", which off course produces a 404-error.
    What is the best way to get rid of this unnecessary request in an Applet?
    - I can't set the property, because I do not know which xml-parser implementation is available at the client .
    - I can't rely on lib/jaxp.properties, obviously!
    - I could not find any conclusive information about the format of this request. It says in the Javadoc, a file at this location is used to determine the Factory? waht is the Format of this file? What should it contain?
    - The applet works fine, as it defaults to the system factory anyway.
    However, the request brings an extra delay in the applet, which I just do not need. I also do not want to download my preferred xml-parser, I want ot use, what ever is installed on the client.
    Any idea what to do?
    Thanks
    Kaj
    Chief Designer at Conficio.com
    What is your Plan-B? We just released Plan-B 2.1

    Thanks!
    Thanks for the fast reply. I don't know if I made my point clear.
    I do not want to determine the parser by myself. I want the client system use the default parser, so I do not have the hit of downloading the fairly large parser jar.
    However, I want it not to do an empty request to the server for nothing. This turn around time kills an Applet. I want a fast loading applet!
    I'll go in trial and error mode, when I find the time next week.
    Thanks again, I appreciate it!
    K<o>

  • How to include AdfcExceptionHandler entry from adf\META-INF\services\

    I am referring to this article from Frank : http://thepeninsulasedge.com/frank_nimphius/2010/02/01/how-to-create-custom-adfc-exception-handler/
    As mentioned in the blog, everything works , exception handler handles the exception , but
    When I create AdfLib JAR, it does not include adf\META-INF\services\ folder
    Thanks,

    Frank,
    Can we use AdfcExceptionHandler in our code directly with out worrying about any backward compatibility issues in future release of ADF? The reason I am asking this question is , it is from oracle.adfinternal. package and ORACLE can change it any time in future.
    What is the alternative if we can not use it?
    Thanks,
    Rama

  • Unable to read facec-config.xml in META-INF folder of webui-jsf.jar

    Hi
    I was getting following error when I placed webui-jsf.jar file in websphere 6.0 server
    /WEB-INF/lib/jsf-extensions-dynamic-faces-0.1.jar!/META-INF/faces-config.xml
    Digester E org.apache.commons.digester.Digester error Parse Error at line 24 column 14: Document is invalid: no grammar found.
    org.xml.sax.SAXParseException: Document is invalid: no grammar found.
    Do I need to add any other parser to read this file ?
    Thanks
    Himaja

    Your classpath is polluted with different JSF implementations/versions. Clean it up.

  • Java Web Start and DNS Service Provider

    I have an implementation of a DNS Service Provider that works fine as an Application. But when deployed as an applet or application through Java Web Start, it is not picking up the DNS provider override
    It is like this. I have a Simple Test Program
    dabba#cat Test.java
    import java.net.*;
    import sun.net.spi.nameservice.NameService;
    import sun.net.spi.nameservice.dns.DNSNameService;
    public class Test {
    public static void main(String args[]) throws Exception{
    try {
    System.setProperty("sun.net.spi.nameservice.provider.1", "dns,mine");
    InetAddress ia = InetAddress.getByName(args[0]);
    System.out.println(ia);
    catch(Exception e) {
    System.out.println("in exception handler" + e);
    dabba# cat MyNameService.java
    import sun.net.spi.nameservice.NameService;
    import sun.net.spi.nameservice.dns.DNSNameService;
    import java.net.UnknownHostException;
    public class MyNameService implements NameService {
    static {
    //System.setProperty("sun.net.spi.nameservice.nameservers", "localhost"); // ETL
    NameService ns;
    public MyNameService() throws Exception {
    ns = new DNSNameService();
    public byte[][] lookupAllHostAddr(String host) throws UnknownHostException {
    System.out.println("*** lookup host = " + host);
    byte[][] a = new byte[1][4];
    a[0][0]=(byte)127;
    a[0][1]=0;
    a[0][2]=0;
    a[0][3]=(byte)1;
    System.out.println("return a.length = " + a.length);
    return a;
    public String getHostByAddr(byte[] addr) throws UnknownHostException {
    throw new Error("not implemented");
    dabba#cat MyNameServiceDescriptor.java
    import sun.net.spi.nameservice.*;
    public final class MyNameServiceDescriptor implements NameServiceDescriptor {
    public NameService createNameService() throws Exception {
    return new MyNameService();
    public String getProviderName() {
    return "mine";
    public String getType() {
    return "dns";
    dabba#cat META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
    # dns service provider descriptor
    MyNameServiceDescriptor
    dabba# java -cp . Test www.sun.com
    *** lookup host = www.sun.com
    return a.length = 1
    www.sun.com/127.0.0.1
    So the above program works as intended as an application. Whatever hostname I specify, it returns localhost. Now, I'm not able to get this to work when I embed this in an Applet or Application launced through Java Web Start. Am I missing something
    thanks,
    Balaji

    We are trying to do the same thing for a different purpose. You need to set the override sooner than WebStart lets you... It has to be on the command line.
    We are trying to overide the default nameservice because it uses reverse dns which is slow at some of our sites. We need to set the parameter
    sun.net.spi.nameservice.provider.1=dns,sun before the VM starts using webstart. The only way we can do this is by setting the environment variable
    JAVAWS_VM_ARGS=-Dsun.net.spi.nameservice.provider.1=dns,sun on the client. This is not real easy from the server side.
    Is there any way we can make the client default to this nameservice provider? There must be some file somewhere on the client I can put this property in...

  • Jar Service Provider

    Hello everybody,
    I'm working on a project that uses Jakarta Commons DBCP. I would like to use Xerces as parser but somehow I always get the org.xml.sax.parser undefined error.
    On http://java.sun.com/xml/jaxp/faq.html I found that I could use the Service Provider Mechanism to include other implementations.
    1. The value of a system property like javax.xml.parsers.DocumentBuilderFactory if it exists and is accessible.
    2. The contents of the file $JAVA_HOME/jre/lib/jaxp.properties if it exists.
    3. The Jar Service Provider discovery mechanism specified in the Jar File Specification. A jar file can have a resource (i.e. an embedded file) such as META-INF/services/javax.xml.parsers.DocumentBuilderFactory containing the name of the concrete class to instantiate.
    Does this also work with Xerces. I have the xercesImpl.jar on the classpath but it does not work.
    Thanks for your help

    Hello Again,
    Does this also work with Xerces. I have the
    xercesImpl.jar on the classpath but it does not work.As it is mentioned in the documentation it should work with Xerces. The question now is, does the topic adressed one question later on the page (Q. Why are there Apache classes in the J2SE 1.4 RI?) also apply here or is that another problem.
    By the way I am using JDK 1.4.2_02 with Eclipse.
    Thanks,
    Michael

  • Service Provider Interface and ImageI/O

    Hello,
    I was wondering if anyone could help me with some basic usages of the ImageI/O methods. I am using some very simple ImageIO commands such as ImageIO.write() and ImageIO.setCaches() to take an image from an applet and send it to a servlet where it can be saved. I followed some online tutorials and I imported javax.imageio.ImageIO and javax.imageio.spi.*. I downloaded Tomcat 4.0.3 to set up on my local machine and test everything. Everything worked and saved just fine although in the Tomcat logs I get errors saying it cannot find
    "HEAD /examples/servlets/IDraw/META-INF/services/javax.imageio.
    spi.ImageWriter", "HEAD /examples/servlets/IDraw/META-INF/services/
    javax.imageio.spi.ImageReader, etc.
    Since everything worked, I didn't think anything about it. I now found a webhost to load everything online to. However now when I try to run, I get similar errors in the webhost log, but it doesn't run. It just stops running on any ImageIO lines.
    I dont' understand how it could have worked on my machine with Tomcat and it cannot work on the server (Unix, Tomcat 4.0.1, JDK 1.4). Also, I don't know how to correct the error that is coming up. None of the tutorials on ImageIO said anything about using the Service Providers.
    I don't have code that is looking for the javax.imageio.spi.* it just seems to be doing it when it gets to an ImageIO line. I dont' know where to put the files or even which files to put b/c it isnt' looking for .class files. If anyone can offer any insight into any piece of this, even a small piece it would be extremely helpful.
    Thank you all for your time.

    If I was to take a wild 'stab' at this, it could be the encoders that the ISP supports, or, as you're using 1.4 (and presumably a recent Tomcat) ur compiled s-side code (the servlet) is not being fully translated by the server.
    Ideas:
    - Try compiling with 1.3
    - ask your ISP what encoders it has /can support

  • Reading META-INF contents from an annotation processor

    Hello,
    I'm trying to read the contents of META-INF with my annotation processor, something akin to:
    @Override
    public boolean process(
    Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
    try {
    FileObject resource = processingEnv.getFiler().getResource(
    StandardLocation.SOURCE_PATH, "META-INF.services", "javax.annotation.processing.Processor");
    String filecontents = new Scanner(resource.openInputStream()).useDelimiter("\\A").next();
    processingEnv.getMessager().printMessage(Kind.NOTE, filecontents);
    } catch (IOException ex) {
    processingEnv.getMessager().printMessage(Kind.ERROR, ex.toString());
    return true;
    (But against something that is relevant for my processor.) But when I do that I get:
    error: javax.annotation.processing.FilerException: Illegal name META-INF.services
    Bug, or shouldn't annotation processors be reading the contents of META-INF anyhow?
    Thanks,
    Thor Michael

    META-INF/services

  • WEB-INF/lib (.war) Vs META-INF/MANIFEST.MF (.ear)

    What are the Class loading differences between libraries that are in a web application web-inf/lib and that are in class-path entry of META-INF/manifest.mf of a ear.
    I recently developed a web services application with a ejb endpoint.Then
    packaged it in a ear file with the classpath entry .The problem occured when I placed the weblogic.jar(and other third party jars) in the ear file which my ejb.jar uses as utility jar's. Jboss starts behaving weird.Some of the classes of jboss are overwritten and class cast exception errors started coming up.
    Overnight I changed the application to a servlet end point and placed all my jars in the WEB-INF/lib then everything started working smooth.
    Can any body help me , understand what is happening. Why doesn't j2ee have something like META-INF/lib

    What did you do to resolve this issue .. I'm having the exact same problem.
    What a nightmare.
    I found approximately 40 forums on this topic (and
    there are probably more), but noone has the definitive
    answer!
    Here's the problem....
    My servlet uses a utility class that resides in some
    other jar. That jar is then placed into the
    WEB-INF\lib directory of the WAR which in turn goes
    into the EAR. This is supposed to be all that is
    needed in order for the utility class to be found on
    the classpath.
    In fact, if you run the war in Tomcat as a standalone
    WAR it does in fact find it.... its when in an EAR
    deloployed to app server that the problem arises.
    I have had no luck with using any combination of
    putting the jar ANYWHERE in the EAR or WAR no matter
    if I specify the Class-Path: in the manifest(s) or
    not.
    I thought maybe that I was missing some config in the
    application.xml or web.xml but I couldn't find
    anything to support that.
    Maybe its dependent on the app server? I am using
    Orion, but the same problem can be found on J2EE RI
    release 1.3
    Work arounds:
    1. Simply put the utility jar in the lib directory of
    the server you're using
    2. Add an ejb module to the application.xml naming the
    utility jar as the ejb jar. Of course this is NOT an
    EJB jar and error messages/warnings will appear
    accordingly, but on Orion at least, it will load the
    classes needed... hooray!!
    Anyone got a definitive answer?

  • How to handle the our stock in logicistic service provide

    Hi,
    I have the scenio and how to config in SAP.Iam placing the PO to vendor, Vendor suply the raw material directly to our logistic service provider when ever we need we pull the stock ( consignment). The stock is in Service provide place.How to design in SAP WM.
    1. I can create the Storage location and assign to WM and create new Storage type ( Service provide area) and store in the Bin
    Pl advice
    Kumar

    closed

  • ERROR ITMS-9000: "META-INF/container.xml must contain one and only one root file reference."

    Hi all,
    After correcting a table-of-contents error in my .epub file, I am unable to upload it via iTunes Producer. It lists this error message:
    ERROR ITMS-9000: "META-INF/container.xml in 9780615431727.epub must contain one and only one root file reference." at Book (MZItmspBookPackage)
    The file has been verified and only has one root file reference in the container.xml file.
    Has anyone been able to find a solution to this problem?
    Thanks!

    Hello Forum Users…
    For those of you who have run into the upload roadblock, getting an error message similar to this:
    Package Summary:
    1 package(s) were not uploaded because they had problems:
              /Users/slm/Desktop/MUSIC to PICTURE for IBOOK/2012 MTP for iTUNES Bookstore/9780615600918.itmsp - Error Messages:
                        Apple's web service operation was not successful
                        Unable to authenticate the package: 9780615600918.itmsp
                        ERROR ITMS-9000: "OPS/ibooks.ncx(5): 'p50': fragment identifier is not defined in 'OPS/content9.xhtml'" at Book (MZItmspBookPackage)
    Following is a "specific" fix, but the idea of the fix will help you with your specifics too.
    I tried for 17 days to upload a book that looked and worked perfectly in iPAD via Preview.
    After many discussions with Apple, who to their credit stayed with me over 2-3 days, I decided to play a hunch.
    I went into a duplicated copy of the book and on every page, (because the error message was not telling the whole story), looked for what InDesign would call "Overset Text."
    Now... the "flaw" in iBOOK Author (hint) is that it won't advise you of this "overset text" as does InDesign.
    And to compound the matter, the exported ePUB document WORKS in iPAD Preview.
    See Screenshots from InDesign:
      Okay... Couldn't add it but it is a Warning Box that says there is overset text. (Characters which exceed the text box.)
    Nevertheless, I played this hunch, and sure enough found a few boxes with the + in them.  In other words I clicked on EVERY text holder and every text block in the entire document.
    Where I found + signs, I simply deleted some carriage returns from the iBOOK file... (please note… carriage returns and literally empty spaces that caused the overset text) and then erased all previous copies of the Music to Picture Book on my hard drive,  iTUNES and iPAD.
    The result?  A "text-book" upload with no snags!  As my Son would say… "Victory!"
    So, first make sure that you are using only PNGs, Jpegs and Movie files to iBook Specs.  Then... make sure there are no overset text boxes, which you must do manually.
    Enjoy & Godspeed!
    Steve
    Stephen Melillo, Composer
    STORMWORKS®
    209 Spinnaker Run
    Smithfield, VA 23430-5623
    USA
    v/f 757-356-1928
    stormworld.com
    “History is a vast early warning system.” Norman Cousins, editor and author (1915-1990)
    "This will be our reply to violence: to make music more intensely, more beautifully, more devotedly than ever before." Leonard Bernstein
    “If you have a chance to help someone, and you don’t, you are wasting your time on this earth.”  Roberto Clemente

Maybe you are looking for