Use of StAX

I tried to use StAX to modify a big XML file and I used the example EventProducerConsumer to start, as it implemented the same process I needed.
After some strange random failures I discovered that for big files you cannot use a FileInputStream to read the Xml file, as in the example (at leas in a Windows environment) . Using a FileReader I was able to process quickly a many big files (the dimension is limited only by the heap).
I don't know if in this was already noticed, as the FileInputStream works fine for small/medium sized file. So, just in case ......
Marco Pancotti

I tried to use StAX to modify a big XML file and I used the example EventProducerConsumer to start, as it implemented the same process I needed.
After some strange random failures I discovered that for big files you cannot use a FileInputStream to read the Xml file, as in the example (at leas in a Windows environment) . Using a FileReader I was able to process quickly a many big files (the dimension is limited only by the heap).
I don't know if in this was already noticed, as the FileInputStream works fine for small/medium sized file. So, just in case ......
Marco Pancotti

Similar Messages

  • Detection of encoding of XML file with the StAX parser

    Hello!
    I am using the StAX parser to read an XML file which can have different encodings.
    I don't know how to detect the encoding before reading the file.
    This is the way I instantiate the reader now:
    XMLStreamReader xmlr = xmlif.createXMLStreamReader(new InputStreamReader (new FileInputStream(inputfile), "utf-8"));
    Is there any way to make the reader detect the encoding with StAX? Is it possible detect the encoding with SAX or DOM?
    Just paste some piece of code and you will help me a lot!
    Thanks,
    Lara

    XML parsers are supposed to auto-detect the encoding of their inputs. The SAX and DOM parsers built into Java, as well as others like Xerces, do that. I don't know whether your StAX parser does, but it should. There is a standard procedure for determining the encoding that is described in the XML spec.
    However if you have malformed XML that fails to declare its encoding properly, then none of those parsers will be able to fix that problem for you.
    Here's the simplified rule as it applies to most files: if the XML file doesn't have a prolog, or if it's prolog doesn't specify an encoding, the parser will assume the file's encoding is UTF-8. If the XML file does have a prolog that specifies an encoding, the parser will assume that encoding.
    Unfortunately it is common for people to write XML files that don't declare an encoding, but to forget to encode the file in UTF-8. Then you have a file that is actually encoded in (e.g.) Windows-1252, but the parser believes it is UTF-8, and this fails when there are non-ASCII characters in the document.

  • Doubt about stax

    Hai
    I want to know whether it is possible to validate a document as it is being built
    using the stax api .We can validate a Document object before transforming it into an xml file using DOM.Is a similar approach possible in stax ?
    Thanks in advance

    Validating STAX parsers do exist. I just verified that with a 30-second Google search.

  • ClassCastException on Deployment in Weblogic 10.3

    When I am deploying my application in Weblogic 10.3, I am getting below Exception.
    weblogic.application.ModuleException:
    com.ctc.wstx.stax.WstxInputFactory cannot be cast to javax.xml.stream.XMLInputFactory
    Earlier I had no problem with Weblogic 8.1.

    I have the exact same issue. I'm trying to deploy a project that uses CXF 2.1 which uses the StaX parser. Here's what I've tried to do:
    In my weblogic.xml, I have the following set to prefer the libraries I have in my WEB-INF/lib:
    <wls:weblogic-web-app xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-web-app"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
    http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
         <wls:context-root>PCRSubmittal</wls:context-root>
         <wls:weblogic-version>10.3</wls:weblogic-version>
         <wls:container-descriptor>
              <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
         </wls:container-descriptor>
    </wls:weblogic-web-app>Then I created a weblogic-application.xml that has the StaX parser defined as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <wls:weblogic-application
         xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-application"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd
    http://www.bea.com/ns/weblogic/weblogic-application
    http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd">
         <!-- server-version: 10.3 -->
         <wls:application-param>
              <wls:param-name>javax.xml.stream.XMLInputFactory</wls:param-name>
              <wls:param-value>com.ctc.wstx.stax.WstxInputFactory</wls:param-value>
         </wls:application-param>
         <wls:application-param>
              <wls:param-name>javax.xml.stream.XMLOutputFactory</wls:param-name>
              <wls:param-value>com.ctc.wstx.stax.WstxOutputFactory</wls:param-value>
         </wls:application-param>
         <wls:application-param>
              <wls:param-name>javax.xml.stream.XMLEventFactory</wls:param-name>
              <wls:param-value>com.ctc.wstx.stax.WstxEventFactory</wls:param-value>
         </wls:application-param>
         <wls:application-param>
              <wls:param-name>webapp.encoding.default</wls:param-name>
              <wls:param-value>UTF-8</wls:param-value>
         </wls:application-param>
         <wls:prefer-application-packages>
              <wls:package-name>javax.jws.*</wls:package-name>
              <wls:package-name>javax.xml.stream.*</wls:package-name>
              <wls:package-name>com.ctc.wstx.*</wls:package-name>
         </wls:prefer-application-packages>
    </wls:weblogic-application>When I deploy I get the following exception:
    Caused by: java.lang.ClassCastException: com.ctc.wstx.stax.WstxInputFactory cannot be cast to javax.xml.stream.XMLInputFactory
         at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:137)
         at weblogic.servlet.internal.TldCacheHelper$TldIOHelper.parseXML(TldCacheHelper.java:124)
         at weblogic.descriptor.DescriptorCache.parseXML(DescriptorCache.java:380)
         at weblogic.servlet.internal.TldCacheHelper.parseTagLibraries(TldCacheHelper.java:65)
         at weblogic.servlet.internal.War.getTagInfo(War.java:891)
         at weblogic.servlet.internal.WebAppServletContext$ServletContextWebAppHelper.getTldInfo(WebAppServletContext.java:3612)
         at weblogic.servlet.internal.WebAppServletContext$ServletContextWebAppHelper.getTagLibHandlers(WebAppServletContext.java:3590)
         at weblogic.servlet.internal.WebAnnotationProcessorImpl.processAnnotations(WebAnnotationProcessorImpl.java:112)
         at weblogic.servlet.internal.WebAppServletContext.processAnnotations(WebAppServletContext.java:1287)
         at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:412)
         at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:456)
         at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:414)
         at weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:910)
         at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:364)

  • Extract data from xml file and insert into another exiting xml fil

    hello,
    i am searching extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
    Regards,
    Zhuozhi

    If the files are small, you can load the target file in a DOM document, insert the data from the source file and persist the DOM.
    If the files are large, you probably want to use a StAX or SAX.

  • Read XML file in JAVA

    Hi ,
    I have an Xml file in the below format.
    Could you please provide the java code to read the attributes from the xml
    <messages>
      <class id="1" name="Test1" fromClass="Class1" toClass="Class2">
      <attribute fromAttribiteName="attr1" fromId="200" toAttribiteName="attr2" toId="201"/>
      <attribute fromAttribiteName="attr3" fromId="202" toAttribiteName="attr4" toId="203"/>
      </class>
      <class id="2" name="Test2" fromClass="Class3" toClass="Class4">
      <attribute fromAttribiteName="attr1" fromId="204" toAttribiteName="attr2" toId="205"/>
      <attribute fromAttribiteName="attr1" fromId="206" toAttribiteName="attr2" toId="207"/>
      </class>
    </messages>Thanks in advance.
    Regards,
    Lak

    There are at least four ways depending on what other XML technology you are already using or plan to use:
    - SAX
    - StAX
    - DOM
    - XPath
    Nobody is going to just hand you the code.

  • Using StAX with xslt transformations in the right way?

    Hi!
    What do I need to enable the stax functionality to transformations, and which transformer implementations is supporting this? (or is the implementation irrelevant)
    I have made the following to create a StaxSource, but is it enought?
    ---8<---
    private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        InputStream xmlInputStream = xmlUrl.openStream();
        XMLStreamReader xmlStreamReader = inputFactory.createXMLStreamReader( xmlInputStream );
        Source xmlSource = new StAXSource( xmlStreamReader );
    transformer.transform(xmlSource, new StreamResult(writer));
    ---8<---I'm using:
    org.apache.xalan.processor.TransformerFactoryImpland every thing seems to work very nice, but I'm not sure if I have done it in the right way and if it's something that I miss.
    If I understand it correct normal transformations is transforming the xml to a Dom-tree but with StAX it shouldn't and be more memory efficient.
    So anyone have any comments?
    /Per

    Indeed, as DrClap has already stated, using a StAXSource will not guarantee streaming. All of the mainstream XSLT processors build some sort of DOM structure internally because, in the general case, XSLT requires random access on the input document. The only exception to this is the identity transform, which in most processors is done in streaming fashion --i.e., without actually creating an intermediate structure.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Creating XML from a POJO using StAX

    Hi Experts,
    I have a POJO and now want to create an XML which has the elements as that of the POJO using StAX.
    Can anybody please help me out.
    Thanks in advance.

    swati_pekam wrote:
    Yes I totally agree with you, had initially used JAXB....however client needs StAX to be used.. :(What? Why?
    Do you mean "client" as in "client side program"?
    In that case, the requirement is bullshit, because the receiving end of the XML doesn't know which technology is used to create it.
    Do you mean "client" as in "the people who pay me to do that"?
    In that case, the requirement is bullshit, because they should not force you to use tools that are not fit for the task ..
    Please clarify this requirement. Why exactly do you think (or does the client think) that you need to use StAX?

  • Help with simple XML reading example using StAX

    Please, could somebody help me with this issue?
    Or, could somebody point me to a comprehensive StAX tutorial?
    thanks!
    I have prepared a simple sample that looks like 'homework', but this newbie task is getting me crazy...
    I just want to store in the object Shop[] shopsArray; the next XML file, using StAX:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <shops>
        <shop>
             <name>Amazon</name>
            <code>AMZ</code>
            <url>www.amazon.com</url>
            <product>
                <book>
                    <name>Core JSF</name>
                    <code>cojsf</code>
                    <price>136</price>
                    <pages>333</pages>
                </book>
            </product>
            <product>
                <book>
                    <name>Java forr Dummies</name>
                    <code>jfd</code>
                    <price>68</price>
                    <pages>400</pages>
                </book>
            </product>
            <product>
                <video>
                    <name>Braveheart</name>
                    <code>brvh</code>
                    <price>15</price>
                    <duration>3h</duration>
                </video>
            </product>
        </shop>
         <!-- <shop>Other types of shops</shop> -->
    </shops>Having the related classes below:
    public class Shop {
         String name;
         String code;
         String url;
         Product[] productsArray;
    public class Product {
         String name;
         String code;
         String price;
    public class Book extends Product {
         String pages;
    public class Video extends Product {
         String duration;
    }

    [http://vtd-xml.sf.net|http://vtd-xml.sf.net] While I am not an expert on StAX, I think you may be interested in vtd-xml to simplify coding as it
    supports random access and XPath
    http://vtd-xml.sf.net

  • Using Stax XMLStreamReader on fragments?

    Im trying to use XMLStreamReader to parse small XML fragments that are streamed from a server to a client.
    Sometimes the fragments refer to namespaces that are defined outside the fragment and XMLStreamReader
    throws an Exception:
    *Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,18]*
    Message: http://www.w3.org/TR/1999/REC-xml-names-19990114#ElementPrefixUnbound
    Is there any way to define the namespaces and their prefixes programmatically? I dont want to disable validation.

    To answer myself. Found out that I can disable namespace awarenes without disabling all validation:
         inputFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);Would still rather like to define the namespaces..

  • Using Stax

    Hi everyone,
    I'm trying to find out if the J2 SDK supports Stax out of the box.
    So far it seems, that even Java 5 only supports DOM and SAX.
    Is this correct?
    Thanks in advance,
    Paulo Pinto

    Yes, I think StAX will become part of the Java platform in Java 6.0 (Mustang). WSDP 1.6 includes an EA implementation.

  • LinkageError while trying to use war-file bundled jars

    Good day.
    I have a servlet for which I want to use the latest JAX-WS 2.1.4 jars. I compile my servlet, and include in the WEB-INF/lib/ directory those same JAX-WS 2.1.4 jars. According to the classloading scheme under the SJWS v7.0, I can enable my servlet to actually use those jars, rather than the functional equivalent, but older, versions the container would provide, by setting delegate="false" in the servlet's sun-web.xml file.
    http://docs.sun.com/app/docs/doc/819-2634/6n4tl5ko9?l=en&a=view
    When I deploy this servlet, and a client makes a request of it, however, I'm getting an odd exception:
    java.lang.LinkageError: JAXB 2.0 API jar is being loaded (from jar:file:/sun/webserver7/lib/webserv-jwsdp.jar!/javax/xml/bind/annotation/XmlSchema.class), but this RI (from jar:file:/sun/webserver7/https-msoa5/web-app/msoa5/tManager/WEB-INF/lib/jaxb-impl.jar!/com/su
    n/xml/bind/v2/model/impl/ModelBuilder.class) requires JAXB 2.1 API jar.
    at com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:173)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
    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:585)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
    at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:220)
    at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:218)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:217)
    at com.sun.xml.ws.spi.ProviderImpl.<clinit>(ProviderImpl.java:88)
    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:494)
    at java.lang.Class.newInstance0(Class.java:350)
    at java.lang.Class.newInstance(Class.java:303)
    at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36)
    at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95)
    at javax.xml.ws.spi.Provider.provider(Provider.java:76)
    at javax.xml.ws.Service.<init>(Service.java:57)
    at com.sun.fast.eventmgr.wsdl.WsdltventManagerV4Service.<init>(WsdltventManagerV4Service.java:46)
    My WEB-INF/lib/ directory contains the jaxb jars, which leaves me puzzled as to why the linkage error. Here is the set of jars in the WEB-INF/lib directory:
    sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/FastInfoset.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/activation.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/http.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/jaxb-api.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/jaxb-impl.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/jaxb-xjc.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/jaxws-api.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/jaxws-rt.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/jaxws-tools.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/jsr173_api.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/jsr181-api.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/jsr250-api.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/mimepull.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/resolver.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/saaj-api.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/saaj-impl.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/sjsxp.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/stax-ex.jar
    /sun/webserver7/https-msoa5/web-app/msoa5/EventManager/WEB-INF/lib/streambuffer.jar
    Any suggestions on what the problem might be?
    Thanks.

    Thanks for the reply.
    The jar containing the sought class would be WEB-INF/lib/jaxb-api.jar per this brute force inspection:
    $ for i in $(find WEB-INF/lib/ -name \*.jar); do echo "---$i"; jar tf $i |grep javax/xml/bind/annotation/XmlSchema.class; done
    ---WEB-INF/lib/jaxb-xjc.jar
    ---WEB-INF/lib/streambuffer.jar
    ---WEB-INF/lib/jaxws-tools.jar
    ---WEB-INF/lib/FastInfoset.jar
    ---WEB-INF/lib/jaxb-api.jar
    javax/xml/bind/annotation/XmlSchema.class
    ---WEB-INF/lib/http.jar
    ---WEB-INF/lib/jsr173_api.jar
    ---WEB-INF/lib/jaxb-impl.jar
    ---WEB-INF/lib/activation.jar
    ---WEB-INF/lib/stax-ex.jar
    ---WEB-INF/lib/jsr181-api.jar
    ---WEB-INF/lib/jaxws-api.jar
    ---WEB-INF/lib/saaj-api.jar
    ---WEB-INF/lib/mimepull.jar
    ---WEB-INF/lib/jaxws-rt.jar
    ---WEB-INF/lib/saaj-impl.jar
    ---WEB-INF/lib/sjsxp.jar
    ---WEB-INF/lib/resolver.jar
    ---WEB-INF/lib/jsr250-api.jar

  • Read only part of a document with Stax

    Hi,
    I have some huge documents (~5GB) and I use Stax to read them.
    My problem: I want to load only a part of the document.
    I know the location that I should put the inputStream, so I skip half of the file.
    Then I push data using xmlReader.hasNext(). After the first iteration though, I get the exception ->
    javax.xml.stream.XMLStreamException: ParseError at [row,col]:[34,4]
    Message: The markup in the document following the root element must be well-formed.
    The original xml is like that:
    <root>
    <element id=1>
    </element>
    <element id=2>
    </element>
    <element id=3>
    </element>
    </root>And I pass to the xmlStreamReader
    <element id=2>
    </element>
    <element id=3>
    </element>So, I know why I get it. Because I include in the input stream only a part.
    When it tries to read the element with id=3 , it says not well formed document.
    which on one hand is correct, but on the other hand not important for me.
    any possible solutions? How to disable the check of xmlstream reader or I don't what.
    no, I cannot wrap a part of a 5Gb file to something else...That's not the point. It will be to slow...
    That why I want to skip so much data in first place, to make it quick.
    The problem is so annoying and a little bit stupid.
    A solution would be to write my own parser, instead of using the XMLStreamReader, but then again, this is stupid, dirty, and duplicate of efforts...
    -------part of the code--------
    FileInputStream inputStream = new FileInputStream(filename);
    inputStream.skip(skipBytes);
    xmlReader = xmlif.createXMLStreamReader(filename, inputStream);
            while (xmlReader.hasNext() && parsingComplete == false) {
                xmlReader.next();
                if (xmlReader.isStartElement()) {
                    parseStartElement(xmlReader);
                    continue;
            }Thanks for the help and any opinions.
    Andreas

    Following the tip about creating a new input stream, I've create a class that extends the FileInputStream, and now it works.
    Extending just the InputStream was really slow. (remember the documents are huge "string" files)
    The code:
    XMLInputFactory xmlif = XMLInputFactory.newInstance();
    xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
    RootElementAppenderFileInputStream skippedInputStream = new RootElementAppenderFileInputStream(file, skipBytes);
    xmlReader = xmlif.createXMLStreamReader(file.getAbsolutePath(), skippedInputStream);
    while (xmlReader.hasNext() && parsingComplete == false) {
        xmlReader.next();
        if (xmlReader.isStartElement()) {
            parseStartElement(xmlReader);
    public class RootElementAppenderFileInputStream extends FileInputStream {
        private ByteArrayInputStream rootElemStreamStart;
        private boolean readingRoot = true;
        public RootElementAppenderFileInputStream(File file, long skipBytes) throws FileNotFoundException, IOException {
            super(file);
            this.rootElemStreamStart = new ByteArrayInputStream("<O>".getBytes());
            this.skip(skipBytes);
        public int read() throws IOException {
            if (readingRoot) {
                int result = rootElemStreamStart.read();
                if (result == -1) {
                    readingRoot = false;
                } else {
                    return result;
            return super.read();
    }

  • Issue while starting AdminSerever using wlst commands

    Hi, I am facing issue while trying to start the AdminServer and Managed Server via nodemanager using wlst commands. I have installelled WebLogic 11g on windows 2008 R2. Mentioned below are the steps that I followed:
    1) In Nodemanager.properties files I set following parameters to true. I did this, so that nodemanager can start the server in case of crash.
    CrashRecoveryEnabled=true
    StartScriptEnabled=true
    2) started nodemanager and then started AdminServer from the command prompt as follows:
    nmConnect('weblogic','password','10.23.226.58','5556','IMDomain','E:\Oracle\Middleware\user_projects\domains\IMDomain','ssl')
    nmStart('AdminServer')
    I dont see any errors but it seems the AdminServer do Not start properly as in the cmd window I don't see any 'started successfully' message - the message remains as *"Starting AdminServer..."*
    However in the adminServer logs I see that the status is Running (refer logs at the end) and I can also see it as Running in weblogic console.
    I really didnt care if its not giving a success message in cmd window but the problem occurs when I start the managedServer. After starting the managed server in about 10 minutes, there is a stuck thread. (I guess it is 10 mins because Stuck Thread MaxTime value is 600).
    If I set StartScriptEnabled=false, and start by directly running the startweblogic.cmd then it works fine.
    I am struggling with this for last 1 week, appreciate any help.
    LOGS.......
    Starting WLS with line:
    E:\PROGRA~1\Java\JDK16~1.0_2\bin\java -client -Xms256m -Xmx1024m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=256m -Dweblogic.Name=AdminServer -Djava.security.policy=E:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.policy -Djavax.xml.stream.XMLInputFactory=weblogic.xml.stax.XMLStreamInputFactory -Dweblogic.security.SSL.nojce=true -Xverify:none -da -Dplatform.home=E:\Oracle\MIDDLE~1\WLSERV~1.3 -Dwls.home=E:\Oracle\MIDDLE~1\WLSERV~1.3\server -Dwli.home=E:\Oracle\MIDDLE~1\WLSERV~1.3\integration -Dweblogic.home=E:\Oracle\MIDDLE~1\WLSERV~1.3\server -Dweblogic.management.discover=true -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole=false -Dweblogic.ext.dirs=E:\Oracle\MIDDLE~1\patch_wls1035\profiles\default\sysext_manifest_classpath;E:\Oracle\MIDDLE~1\patch_ocp360\profiles\default\sysext_manifest_classpath weblogic.Server
    <Mar 14, 2012 3:16:30 PM CDT> <Info> <Security> <BEA-090905> <Disabling CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true>
    <Mar 14, 2012 3:16:30 PM CDT> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true>
    <Mar 14, 2012 3:16:30 PM CDT> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 20.2-b06 from Sun Microsystems Inc.>
    <Mar 14, 2012 3:16:31 PM CDT> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3.5.0 Fri Apr 1 20:20:06 PDT 2011 1398638 >
    <Mar 14, 2012 3:16:32 PM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
    <Mar 14, 2012 3:16:32 PM CDT> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool>
    <Mar 14, 2012 3:16:32 PM CDT> <Notice> <Log Management> <BEA-170019> <The server log file E:\Oracle\Middleware\user_projects\domains\IMDomain\servers\AdminServer\logs\AdminServer.log is opened. All server side log events will be written to this file.>
    <Mar 14, 2012 3:16:36 PM CDT> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
    <Mar 14, 2012 3:16:37 PM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY>
    <Mar 14, 2012 3:16:37 PM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
    Mar 14, 2012 3:16:39 PM com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Initializing Sun's JavaServer Faces implementation (1.2_03-b04-FCS) for context '/console'
    Mar 14, 2012 3:16:39 PM com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Completed initializing Sun's JavaServer Faces implementation (1.2_03-b04-FCS) for context '/console'
    <Mar 14, 2012 3:16:40 PM CDT> <Notice> <Log Management> <BEA-170027> <The Server has established connection with the Domain level Diagnostic Service successfully.>
    <Mar 14, 2012 3:16:40 PM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN>
    <Mar 14, 2012 3:16:40 PM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING>
    <Mar 14, 2012 3:16:40 PM CDT> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 10.227.211.13:8001 for protocols iiop, t3, ldap, snmp, http.>
    <Mar 14, 2012 3:16:40 PM CDT> <Notice> <WebLogicServer> <BEA-000329> <Started WebLogic Admin Server "AdminServer" for domain "IMDomain" running in Production Mode>
    <Mar 14, 2012 3:16:40 PM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
    <Mar 14, 2012 3:16:40 PM CDT> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090171> <Loading the identity certificate and private key stored under the alias DemoIdentity from the jks keystore file E:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\DemoIdentity.jks.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090169> <Loading trusted certificates from the jks keystore file E:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\DemoTrust.jks.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090169> <Loading trusted certificates from the jks keystore file E:\PROGRA~1\Java\JDK16~1.0_2\jre\lib\security\cacerts.>
    <Mar 14, 2012 3:20:53 PM CDT> <Alert> <Security> <BEA-090152> <Demo trusted CA certificate is being used in production mode: [
    Version: V3
    Subject: CN=CACERT, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
    Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4
    Key: Sun RSA public key, 512 bits
    modulus: 9550192877869244258838480703390456015046425375252278279190673063544122510925482179963329236052146047356415957587628011282484772458983977898996276815440753
    public exponent: 65537
    Validity: [From: Thu Mar 21 14:12:27 CST 2002,
                   To: Tue Mar 22 15:12:27 CDT 2022]
    Issuer: CN=CACERT, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
    SerialNumber: [    33f10648 fcde0deb 4199921f d64537f4]
    Certificate Extensions: 1
    [1]: ObjectId: 2.5.29.15 Criticality=true
    KeyUsage [
    Key_CertSign
    Algorithm: [MD5withRSA]
    Signature:
    0000: 9D 26 4C 29 C8 91 C3 A7 06 C3 24 6F AE B4 F8 82 .&L)......$o....
    0010: 80 4D AA CB 7C 79 46 84 81 C4 66 95 F4 1E D8 C4 .M...yF...f.....
    0020: E9 B7 D9 7C E2 23 33 A4 B7 21 E0 AA 54 2B 4A FF .....#3..!..T+J.
    0030: CB 21 20 88 81 21 DB AC 90 54 D8 7D 79 63 23 3C .! ..!...T..yc#<
    ] The system is vulnerable to security attacks, since it trusts certificates signed by the demo trusted CA.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=Entrust Root Certification Authority - G2,OU=(c) 2009 Entrust\, Inc. - for authorized use only,OU=See www.entrust.net/legal-terms,O=Entrust\, Inc.,C=US". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=thawte Primary Root CA - G3,OU=(c) 2008 thawte\, Inc. - For authorized use only,OU=Certification Services Division,O=thawte\, Inc.,C=US". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=T-TeleSec GlobalRoot Class 3,OU=T-Systems Trust Center,O=T-Systems Enterprise Services GmbH,C=DE". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=T-TeleSec GlobalRoot Class 2,OU=T-Systems Trust Center,O=T-Systems Enterprise Services GmbH,C=DE". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=GlobalSign,O=GlobalSign,OU=GlobalSign Root CA - R3". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "OU=Security Communication RootCA2,O=SECOM Trust Systems CO.\,LTD.,C=JP". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=VeriSign Universal Root Certification Authority,OU=(c) 2008 VeriSign\, Inc. - For authorized use only,OU=VeriSign Trust Network,O=VeriSign\, Inc.,C=US". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=KEYNECTIS ROOT CA,OU=ROOT,O=KEYNECTIS,C=FR". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
    <Mar 14, 2012 3:20:53 PM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=GeoTrust Primary Certification Authority - G3,OU=(c) 2008 GeoTrust Inc. - For authorized use only,O=GeoTrust Inc.,C=US". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.>
    <Mar 15, 2012 11:41:41 AM CDT> <Error> <WebLogicServer> <BEA-000337> <[STUCK] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' has been busy for "650" seconds working on the request "weblogic.kernel.WorkManagerWrapper$1@68a3f7ed", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
    java.net.SocketInputStream.socketRead0(Native Method)
    java.net.SocketInputStream.read(SocketInputStream.java:129)
    weblogic.utils.io.ChunkedInputStream.read(ChunkedInputStream.java:159)
    java.io.InputStream.read(InputStream.java:85)
    com.certicom.tls.record.ReadHandler.readFragment(Unknown Source)
    com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
    com.certicom.tls.record.ReadHandler.read(Unknown Source)
    com.certicom.io.InputSSLIOStreamWrapper.read(Unknown Source)
    sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
    sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
    sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
    java.io.InputStreamReader.read(InputStreamReader.java:167)
    java.io.BufferedReader.fill(BufferedReader.java:136)
    java.io.BufferedReader.readLine(BufferedReader.java:299)
    java.io.BufferedReader.readLine(BufferedReader.java:362)
    weblogic.nodemanager.client.NMServerClient.checkResponse(NMServerClient.java:289)
    weblogic.nodemanager.client.NMServerClient.checkResponse(NMServerClient.java:314)
    weblogic.nodemanager.client.NMServerClient.start(NMServerClient.java:102)
    weblogic.nodemanager.mbean.StartRequest.start(StartRequest.java:75)
    weblogic.nodemanager.mbean.StartRequest.execute(StartRequest.java:47)
    weblogic.kernel.WorkManagerWrapper$1.run(WorkManagerWrapper.java:63)
    weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    >
    <Mar 15, 2012 11:42:41 AM CDT> <Error> <WebLogicServer> <BEA-000337> <[STUCK] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' has been busy for "710" seconds working on the request "weblogic.kernel.WorkManagerWrapper$1@68a3f7ed", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
    java.net.SocketInputStream.socketRead0(Native Method)
    java.net.SocketInputStream.read(SocketInputStream.java:129)
    weblogic.utils.io.ChunkedInputStream.read(ChunkedInputStream.java:159)
    java.io.InputStream.read(InputStream.java:85)
    com.certicom.tls.record.ReadHandler.readFragment(Unknown Source)
    com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
    com.certicom.tls.record.ReadHandler.read(Unknown Source)
    com.certicom.io.InputSSLIOStreamWrapper.read(Unknown Source)
    sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
    sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
    sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
    java.io.InputStreamReader.read(InputStreamReader.java:167)
    java.io.BufferedReader.fill(BufferedReader.java:136)
    java.io.BufferedReader.readLine(BufferedReader.java:299)
    java.io.BufferedReader.readLine(BufferedReader.java:362)
    weblogic.nodemanager.client.NMServerClient.checkResponse(NMServerClient.java:289)
    weblogic.nodemanager.client.NMServerClient.checkResponse(NMServerClient.java:314)
    weblogic.nodemanager.client.NMServerClient.start(NMServerClient.java:102)
    weblogic.nodemanager.mbean.StartRequest.start(StartRequest.java:75)
    weblogic.nodemanager.mbean.StartRequest.execute(StartRequest.java:47)
    weblogic.kernel.WorkManagerWrapper$1.run(WorkManagerWrapper.java:63)
    weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    >

    Hi chamila,
        I never tried the example. Exception is not clear. Could you please post more stack trace from log files.
    Thanks,
    Sham

  • Need help in use of XMLResolver resolveEntity method

    Hi,
    I have implemented the XMLResolver interface and set the resolver to XMLInputFactory.setXMLResolver method.
    But when i try to execute the below program it throws exception.
    Below is the code. Could anyone guide me how to proceed ...
    ---Main java file ---------
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.InputStream;
    import javax.xml.stream.XMLInputFactory;
    import javax.xml.stream.XMLResolver;
    import javax.xml.stream.XMLStreamConstants;
    import javax.xml.stream.XMLStreamException;
    import javax.xml.stream.XMLStreamReader;
    public class ResolverTest {
         static String testPrefix = "JAXBSD";
              static String testNo = "002";
              static String testID = testPrefix + testNo;
         * @param args
         public static void main(String[] args) {
    XMLInputFactory xmlif = XMLInputFactory.newInstance();
    xmlif.setXMLResolver(new XMLResolverAdapter(xmlif));
    InputStream inputStream;
         try {
              File file = new File(testNo + "/XMLResolverTest.xml");
              String systemId = file.toURI().toString() ;
              System.out.println("------"+systemId);
              inputStream = new FileInputStream(file);
              XMLStreamReader streamReader = xmlif.createXMLStreamReader(systemId,inputStream);
    while(streamReader.hasNext()){
    int eventType = streamReader.next() ;
    if(eventType == XMLStreamConstants.START_ELEMENT){
    eventType = streamReader.next() ;
    System.out.println("---4---");
    if(eventType == XMLStreamConstants.CHARACTERS){
    String text = streamReader.getText() ;
    System.out.println("-----------hey i got it replace entity----------------------------"+ text);
         } catch (XMLStreamException e) {
              System.out.println("-----XMLStreamException-------"+ e.getMessage());
         }catch(Exception e)
              System.out.println("-----Exception-------"+ e.getMessage());
    class XMLResolverAdapter implements XMLResolver {
    private final XMLInputFactory inputFactory;
    String testNo = "002";
    public XMLResolverAdapter(XMLInputFactory inputFactory ) {
    this.inputFactory = inputFactory;
    public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace) throws XMLStreamException {
    InputStream inputStream;
                   try {
                        inputStream = new FileInputStream(new File(testNo + "/replace2.txt"));
                   } catch (FileNotFoundException e) {
                        throw new XMLStreamException(e.getMessage());
    return inputFactory.createXMLStreamReader(inputStream);
    ---------------------------------- xml file ----------------------
    <!--
    Document : XMLResolverTest.xml
    -->
    <!DOCTYPE root [
    <!ENTITY replace PUBLIC "-//W3C//DTD HTML //EN" "E:/stax/JAXBSD/002/replace1.txt">
    ]>
    <root>&replace;</root>
    ----------------------- replace1.txt file ---------------------------
    <!--
    replace1. txt
    -->
    replace1
    ------------------- replace2.txt ------------------------------------
    <!--
    replace2.txt
    -->
    replace2
    --------------------------------

    Actually i am trying to use the javax.xml.stream.XMLResolver to resolve Entity. which return the resource (i.e XMLStreamReader ).
    Here is the code ...
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.InputStream;
    import javax.xml.stream.XMLInputFactory;
    import javax.xml.stream.XMLResolver;
    import javax.xml.stream.XMLStreamConstants;
    import javax.xml.stream.XMLStreamException;
    import javax.xml.stream.XMLStreamReader;
    import javax.xml.transform.stream.StreamSource;
    public class StaxResolver002 {
             static String testPrefix = "StaxResolver";
              static String testNo = "002";
              static String testID = testPrefix + testNo;
          * @param args
         public static void main(String[] args) {
           XMLInputFactory xmlif = XMLInputFactory.newInstance();
           xmlif.setProperty("javax.xml.stream.isSupportingExternalEntities", Boolean.TRUE);
            xmlif.setProperty("javax.xml.stream.isNamespaceAware", Boolean.FALSE);
           xmlif.setXMLResolver(new XMLResolverAdapter(xmlif));
            InputStream inputStream;
             try{
               File file = new File(testNo + "/XMLResolverTest.xml");
               String systemId = file.toURI().toString() ;
               inputStream = new FileInputStream(file);
               XMLStreamReader  streamReader = xmlif.createXMLStreamReader(inputStream);
               System.out.println("---1---");
                while(streamReader.hasNext()){
                  int eventType = streamReader.next() ;
                  System.out.println("---2---" + eventType);
                  if(eventType == XMLStreamConstants.START_ELEMENT){
                    //eventType = streamReader.next() ;
                    //if(eventType == XMLStreamConstants.CHARACTERS){
                                 //String text = streamReader.getText() ;
                                // assertTrue(text.equals("replace2"));
                                //System.out.println("-----------CHK:002: replace1 with replace2----------------------------"+ text);
                     System.out.println("-----------CHK:002: ----------------------------");
                 /*if(eventType == XMLStreamConstants.CHARACTERS){
                                     String text = streamReader.getText() ;
                                    // assertTrue(text.equals("replace2"));
                                  System.out.println("-----------replace entity----------------------------"+ text);
          } catch (XMLStreamException e) {
              System.out.println("-----XMLStreamException-------"+ e.getMessage());
          }catch(Exception e)
               e.printStackTrace();
               //System.out.println("-----Exception-------"+ e.getMessage());
    class XMLResolverAdapter implements XMLResolver {
        private final XMLInputFactory inputFactory;
        String testNo = "002";
        public XMLResolverAdapter(XMLInputFactory inputFactory ) {
            this.inputFactory = inputFactory;
        public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace) throws XMLStreamException {
                InputStream inputStream;
                 XMLStreamReader  streamReader = null;
                StreamSource ss;
                   try {
                         File file = new File(testNo + "/replace2.xml");
                     String systemId = file.toURI().toString() ;
                         inputStream = new FileInputStream(file);
                        streamReader  = inputFactory.createXMLStreamReader(systemId,inputStream);
                   } catch (Exception e) {
                        //throw new XMLStreamException(e.getMessage());
                        e.printStackTrace();
               return streamReader;
    }Edited by: prinu on May 26, 2009 7:38 PM
    Edited by: prinu on May 26, 2009 7:39 PM

Maybe you are looking for

  • My 2007 Intel Macbook Pro had Tiger 10.4. Can I boot into that drive,now an external, with my 2011 Macbook Pro?

    I have software that is no longer compatible with my 2011 MacBook Pro that I would like to continue to use. When I upgraded my old 2007 MBP from Tiger to Leopard, I did a clean install on a new drive, and put the original internal in an external case

  • Information about javascript in pdf forms

    Hello folks. Could anybody tell me where i can find information about application javascript language in pdf forms? I've visited adobe.com and found a lot of pdf articles but they are really useless. I want to find about object model of pdf form, abo

  • How to include page fragment for JSF application deployed on WebSphere?

    Hi all, I have the following urgent JSF problem, I hope that you can support me in solving it; - I have JSF application need to be deployed on IBM WebSphere 6.0.1 Application Server. - I have the tag: <jsp:directive.include file="Actions.jspf"/> whic

  • How to Get Notified When Someone Replies - Video

    You may not be able to visit the Forum every day, to check if your post has been answered or not. There are two ways to follow conversations in the community. a. The first way is to while posting on the forum: While you are making a post, there is a

  • Consolidation hanged:HFM a/c movement

    Hi, we started march data consolidation. But we made some metadata changes for entity and custom dimension that we usually do. However, we also moved an a/c from one rollup to another rollup. usually consolidation takes 30 mins. But this time, the co