XSQLRequest problem.

Hi,
I'm having some problems with the XSQLRequest.process() method and would appreciate any help.
I have an .xsql file that excepts a parameter called moltid and returns the needed xml. When I call this page from a regular html form I get the correct xml document back.
The problem comes when I try to request this document in a java serlvet. I create the request and a Hashtable containing the moltid parameter to pass to the page, make the request to process and get back an xml document that appears as if the parameter was not passed to it. The following is a section of my code:
// get the moltid
moltid = request.getParameter("moltid");
// Construct the URL of the XSQL Page
URL pageUrl = new URL("http://129.43.26.68/xml/mt_xml.xsql");
// Construct a new XSQL Page request
XSQLRequest xsqlRequest = new XSQLRequest(pageUrl);
// create a hashtable to hold the moltid parameter
Hashtable xsqlParams = new Hashtable(1);
xsqlParams.put("moltid", moltid);
// make the request passing the parameter to the page
xsqlRequest.process(xsqlParams, out, out);
After making this request this is the document I get back:
<?xml version="1.0" ?>
- <target>
<moltid />
<cell-line-data />
</target>
Needless to say there should be data associated with <moltid> and <cell-line-data>. It seems as if the moltid parameter in the Hashtable is not getting passed to the .xsql page.
Can anybody help?
Thanks,
Chris.
null

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by [email protected]:
What role is your additional servlet playing in this picture? Wouldn't you get the result your looking for by letting the XSQL Servlet handle the request directly?
What platform and exact JVM are you using?<HR></BLOCKQUOTE>
Platform is win2000. JVM is the jdk1.2.2 from Sun.
In trying to get this to work I've discovered that it really does seem to be something with passing the Hashtable containing the parameters. I got it to work if I create the URL to include the parameter such as in the following code:
// Construct the URL of the XSQL Page
URL pageUrl = new URL("http://129.43.26.68/xml/mt_xml.xsql?moltid=" + moltid);
// Construct a new XSQL Page request
XSQLRequest xsqlRequest = new XSQLRequest(pageUrl);
// make the request passing the parameter to the page
xsqlRequest.process();
It's when I try to use the Hashtable to pass the parameters as in my previous post that it doesn't seem to work.
I'm not quite certain I understand your question about the role of my servlet. My servlet asks for an XML doc thru the url and then will parse the data in the XML to manipulate it the way I need it displayed. The XSQL Servlet just passes the data back, correct? I'm sure I could do other things using XSL, etc., but I wanted to try certain things where I take the data from the XML and build various objects to use and display the data.
Again any help would be appreciated at understanding why I can't seem to use the Hashtable way.
Thanks,
Chris.
null

Similar Messages

  • Problem with XSQLRequest.process

    Problem with XSQLRequest.process:
    I'm trying to run XSQL files using XSQLRequest.process. I'm working on the chapter 3 examples in Muench's book and got FAQXML.xsql running okay but have had problems with: FAQhtml.xsql BTW I am calling them from a different directory and am using 9iAS under win2K SP3.:
    I've fixed errors such as:
    End tag does not match start tag 'img'.
    by adding </img>
    and:
    End tag does not match start tag 'META'.
    by removing the <head> section from the xsl.
    But now i've got:
    XML parse error at line 2, char 1
    Expected 'EOF'.
    and don't have a clue.
    Some questions I have are:
    --Why don't I get these errors when I run the same files from Internet Explorer?
    --Where is the intermediate XML file?
    --How will I get HTML output?
    I'd appreciate any help you could suggest.
    Peter.
    Here is the .xsql and some of the .xsl:
    <?xml version="1.0"?>
    <!-- FAQHTML.xsql: Show FAQ.xsql in HTML Format for browsers -->
    <?xml-stylesheet type="text/xsl" href="http://localhost/ch03/FAQ-In-HTML.xsl"?>
    <xsql:include-xsql href="FAQ.xsql" xmlns:xsql="urn:oracle-xsql"/>
    <!-- FAQ-In-HTML.xsl: Transform ROWSET/ROW format into HTML Format -->
    <html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    -->
    <body>
    <center>
    <table border="0">
    <tr>
    <th>Question</th>
    <th>Difficulty</th>
    </tr>
    <xsl:for-each select="ROWSET/ROW">
    <tr>
    <td>
    <table border="0" cellspacing="0">
    etc...

    XSQL version is 1.0.2.0.
    Well, in answer to your import question, yes. Xerces can import Xerces documents properly. Thus if we use Xerces importNode on a document parsed/created using Xerces' DOM implementation, the attribute values stay.
    We are using Xerces because it is the foundation of our infrastructure layer (which is partly because it's used in Catalina).
    Question. Is it possible that XSQLParserHelper which, as you say, uses an instance of oracle.xml.parser.v2.DOMParser to parse the document, is having trouble with different versions of DOM? I ask because we've noticed that to use Catalina and have its class loader to function successfully, we had strip all the DOM classes from xmlparserv2.jar
    importNode snippit ...
    public void service(CioServletRequest req, CioServletResponse resp) throws ServletException {
    DomResponse respm = resp.createDomResponse();
    Document dbdoc = respm.getDocument();
    XSQLRequest req = new XSQLRequest( pageUrl );
    ByteArrayOutputStream ostream = new ByteArrayOutputStream();
    req.process(params, ostream, new PrintWriter(System.err));
    String s = new String(ostream.toByteArray());
    Document retDoc = respm.parseDocument(s);
    dbdoc.appendChild(dbdoc.importNode(retDoc.getDocumentElement(), true));
    Hope this helps.
    Steve.
    null

  • XSQLRequest ,XSLProcessor , XSLStylesheet  Memory Problem

    Solaris & NT.
    Using the following processor combination to generate xmldocuments for an output stream, We are experiencing what appears to be a over caching of xml objects or objects not being garbage collected after use. (JProb on OC4J analysis)
    The processing works repeatedly - using a JVM with -mx=98MB after a processing some XML Objects accumulate until whatever memory resources you have allocated are exhausted. Currently processing 1200 documents will generate enough left over objects to bring the system to a halt and OutOfMemory Error.
    XSLStylesheet sheet = null;
    XSLProcessor xslt = new XSLProcessor();
    XSQLRequest req = new XSQLRequest(new URL(resMasterGetUrl));
    Hashtable params = new Hashtable(1);
    params.put("pageName",urlFilename.toString().toLowerCase());
    OutputStream out
    xslt.processXSL(new XSLStylesheet((XMLDocument)req.processToXML(params),new URL(resMasterGetBaseStyleUrl)),xmlParameters,out);
    out.close();
    req = null;
    xslt = null;
    sheet = null;
    params = null;
    COUNT MEMORY
    oracle.xml.parser.v2     DOMParser     1 ( 0.0%)     20 ( 0.0%)     
    oracle.xml.parser.v2     DTD     1 ( 0.0%)     68 ( 0.0%)     
    oracle.xml.parser.v2     DocumentBuilder     1 ( 0.0%)     92 ( 0.0%)     
    oracle.xml.parser.v2     Entry     910 ( 2.2%)     18,200 ( 0.2%)     
    oracle.xml.parser.v2     EqualExpr     5 ( 0.0%)     180 ( 0.0%)     
    oracle.xml.parser.v2     FastVector     57 ( 0.1%)     684 ( 0.0%)     
    oracle.xml.parser.v2     FilterExpr     53 ( 0.1%)     5,300 ( 0.1%)     
    oracle.xml.parser.v2     FromAttributes     1 ( 0.0%)     4 ( 0.0%)     
    oracle.xml.parser.v2     FromChildren     20 ( 0.0%)     80 ( 0.0%)     
    oracle.xml.parser.v2     FromDescendantAttributes     1 ( 0.0%)     4 ( 0.0%)     
    oracle.xml.parser.v2     FromDescendants     25 ( 0.1%)     300 ( 0.0%)     
    oracle.xml.parser.v2     FromSelf     5 ( 0.0%)     60 ( 0.0%)     
    oracle.xml.parser.v2     NSNameImpl     38 ( 0.1%)     760 ( 0.0%)     
    oracle.xml.parser.v2     NodeFactory     5 ( 0.0%)     20 ( 0.0%)     
    oracle.xml.parser.v2     NonValidatingParser     1 ( 0.0%)     116 ( 0.0%)     
    oracle.xml.parser.v2     ObjectPool     46 ( 0.1%)     552 ( 0.0%)     
    oracle.xml.parser.v2     ParserState     2 ( 0.0%)     72 ( 0.0%)     
    oracle.xml.parser.v2     PathExpr     53 ( 0.1%)     3,180 ( 0.0%)     
    oracle.xml.parser.v2     Predicate     1 ( 0.0%)     12 ( 0.0%)     
    oracle.xml.parser.v2     SAXAttrList     2 ( 0.0%)     72 ( 0.0%)     
    oracle.xml.parser.v2     Step     28 ( 0.1%)     1,904 ( 0.0%)     
    oracle.xml.parser.v2     StringHashtable     1 ( 0.0%)     4 ( 0.0%)     
    oracle.xml.parser.v2     XMLAttr     230 ( 0.6%)     13,800 ( 0.2%)     
    oracle.xml.parser.v2     XMLAttrList     288 ( 0.7%)     3,456 ( 0.0%)     
    oracle.xml.parser.v2     XMLComment     44 ( 0.1%)     1,584 ( 0.0%)     
    oracle.xml.parser.v2     XMLDOMImplementation     1 ( 0.0%)     4 ( 0.0%)     
    oracle.xml.parser.v2     XMLDeclPI     5 ( 0.0%)     260 ( 0.0%)     
    oracle.xml.parser.v2     XMLDocument     5 ( 0.0%)     500 ( 0.0%)     
    oracle.xml.parser.v2     XMLElement     308 ( 0.7%)     18,480 ( 0.2%)     
    oracle.xml.parser.v2     XMLEntity     6 ( 0.0%)     600 ( 0.0%)     
    oracle.xml.parser.v2     XMLError     6 ( 0.0%)     456 ( 0.0%)     
    oracle.xml.parser.v2     XMLNodeList     139 ( 0.3%)     1,668 ( 0.0%)     
    oracle.xml.parser.v2     XMLPI     1 ( 0.0%)     36 ( 0.0%)     
    oracle.xml.parser.v2     XMLReader     1 ( 0.0%)     92 ( 0.0%)     
    oracle.xml.parser.v2     XMLText     498 ( 1.2%)     17,928 ( 0.2%)     
    oracle.xml.parser.v2     XMLUTF8Reader     1 ( 0.0%)     108 ( 0.0%)     
    oracle.xml.parser.v2     XSLAttribute     5 ( 0.0%)     580 ( 0.0%)     
    oracle.xml.parser.v2     XSLCondition     5 ( 0.0%)     540 ( 0.0%)     
    oracle.xml.parser.v2     XSLExprValue     106 ( 0.3%)     4,664 ( 0.1%)     
    oracle.xml.parser.v2     XSLForEach     7 ( 0.0%)     756 ( 0.0%)     
    oracle.xml.parser.v2     XSLNode     2 ( 0.0%)     200 ( 0.0%)     
    oracle.xml.parser.v2     XSLNodeList     103 ( 0.2%)     1,236 ( 0.0%)     
    oracle.xml.parser.v2     XSLNodeSetExpr     2 ( 0.0%)     72 ( 0.0%)     
    oracle.xml.parser.v2     XSLOutput     1 ( 0.0%)     148 ( 0.0%)     
    oracle.xml.parser.v2     XSLResultElement     87 ( 0.2%)     10,092 ( 0.1%)     
    oracle.xml.parser.v2     XSLStylesheet     1 ( 0.0%)     172 ( 0.0%)     
    oracle.xml.parser.v2     XSLTemplate     3 ( 0.0%)     540 ( 0.0%)     
    oracle.xml.parser.v2     XSLValueOf     6 ( 0.0%)     648 ( 0.0%)     
    oracle.xml.parser.v2     XSLVariable     23 ( 0.1%)     2,852 ( 0.0%)     
    oracle.xml.xsql     XSQLConfigManager     1 ( 0.0%)     100 ( 0.0%)     
    oracle.xml.xsql     XSQLConnectionManagerFactoryImpl     1 ( 0.0%)     4 ( 0.0%)     
    oracle.xml.xsql     XSQLLRUCache     2 ( 0.0%)     40 ( 0.0%)     
    oracle.xml.xsql     XSQLLRUCache$LRUNode     2 ( 0.0%)     40 ( 0.0%)     
    oracle.xml.xsql     XSQLNamedConnection     9 ( 0.0%)     180 ( 0.0%)     
    oracle.xml.xsql     XSQLPage     1 ( 0.0%)     12 ( 0.0%)     
    oracle.xml.xsql     XSQLPageManager     1 ( 0.0%)     4 ( 0.0%)     
    oracle.xml.xsql     XSQLStylesheet     1 ( 0.0%)     20 ( 0.0%)     
    oracle.xml.xsql     XSQLStylesheetManager     1 ( 0.0%)     4 ( 0.0%)     
    oracle.xml.xsql     XSQLStylesheetPool     1 ( 0.0%)     52 ( 0.0%)

    Also, please note what exact version of Oracle XDK for Java you are using. You can find this out (if you're not sure) by doing:
      System.out.println(DOMParser.getReleaseVersion());

  • Maximum Open Cursors Exceeded problem in XSQL

    Hi,
    We are processing an XSQL page by calling XSQLRequest.process() programatically within our application. Within the XSQL page there are several queries which involve multiple nested CURSOR expressions... when the query returns enough rows we are running into the error "ORA-00604: error occurred at recursive SQL level 1 ORA-01000: maximum open cursors exceeded".
    When searching this forum I have seen many (old) postings regarding this error and a bug in the XDK... seems like it was some time ago, but while we set about improving the structure of our XSQL page (or increasing the max open cursor init parameter currently at 500 or both) can anyone confirm that this bug no longer exists?
    Also, any general suggestions on working around this limit rather than increasing it? We have considered splitting up our queries into smaller queries (and merging the results via XSLT) and closing cursors during the session explicitly by issuing commits within the XSQL page... but any better ideas?
    Thanks,
    Bob

    I have found this max open cursors problem to be related to Statement object not being closed. This presents a problem for the use of PreparedStatements, because they are only useful if you can keep them open and resuse them. However, in doing so, each iteration through the PreparedStatement creates another open cursor in the databse rather than reusing the previous one. A work around I discovered by reading about REF CURSORS and I use in JDBC is as follows:
    Assuming a previously prepared PreparedStatement pstmt and a ResultSet rset-
    while (rset.next()) {
    rset.close();
    // This line closes the cursor in the database
    // but does not require you to re-prepare the
    // PreparedStatement. Don't ask me why--ask the
    // Oracle API guys.
    rset.getStatement().close();
    // make ready for GC
    rset = null;

  • Error handling for XSQLRequest?

    Hi,
    I'm using the XSQLRequest class
    programmatically from within a
    servlet. I works great.
    It takes streams for out and err...
    But is there any way to detect errors
    via the exception mechanism so that
    I can take appropriate steps to correct
    the problem and alert the user?
    cheers,
    Vijay
    null

    All errors are handled via the error stream. No exceptions get raised. What kind of error are you trying to trap, for future feature planning?

  • A XSQLRequest Mystery Solved: Please Read

    On various occasions, folks have complained that, when working with the XSQLRequest class, that their parameters are not properly handled. It always seems to happen when they are creating the XSQLRequest object by passing it a URL which is based on an http://[] protocol scheme.
    Today I believe I finally found the explanation for this, so let me explain.
    Say you have an XSQL Page like this:<xsql:query connection="research" xmlns:xsql="urn:oracle-xsql">
    select pkTelephone.registerDamage
    ( to_number({@txtTelephone}),
    to_number({@txtDamageType}),
    '{@txtComments}'
    ) as RESULT
    from dual
    </xsql:query>and a sample program that's trying to use XSQLRequest like this:import oracle.xml.xsql.XSQLRequest;
    import java.util.Hashtable;
    import java.io.PrintWriter;
    import java.net.URL;
    public class XSQLRequestSample
    public static void main( String[] args) throws Exception
    // Construct the URL of the XSQL Page
    URL pageUrl = new URL("http://fchaves/iopenflex/xapi/dano.registrar.xsql");
    // Construct a new XSQL Page request
    XSQLRequest req = new XSQLRequest(pageUrl);
    Hashtable params = new Hashtable(4);
    params.put("txtTelephone","1");
    params.put("txtDamageType","1");
    params.put("txtComments","1");
    req.process(params,new PrintWriter(System.out),new PrintWriter(System.err));
    }When the XSQLRequest class retrieves the XSQL page template to process by requesting the URL that is specified, [b]http://fchaves/iopenflex/xapi/dano.registrar.xsql, it requests the "dano.registrar.xsql" page from the fchaves web server (listening on the default port 80).
    Since (as is likely the case with many of the customers who have reported the problem here) the fchaves web server is configured to process requests for pages that end in *.xsql using the XSQL Servlet, before the requesting program -- the XSQLRequestSample in this case -- receives the result, the page is processed on the server by the XSQL Servlet before getting returned to the XSQLRequest class.
    Since the request for the b]http://fchaves/iopenflex/xapi/dano.registrar.xsql page does not specify any parameters on the URL, then when the page is processed on the server, all three of the parameters it is expecting (txtTelephone,txtDamageType,txtComments) are blank, so the server-side XSQL Servlet engine processes the page and ends up producing and returning the resulting page to the requesting XSQLRequest class:
    <xsql-error action="xsql:query">
    <statement>select pkTelephone.registerDamage
    ( to_number(),
    to_number(),
    ) as RESULT
    from dual</statement>
    <message>ORA-00938: not enough arguments for function
    </message>
    </xsql-error>The XSQLRequest class then tries to process this returned XML document as an XSQL page template and, not finding any XSQL action elements in the <xsql:*> namespace, simply passes the document through as is.
    So, the result is that the person who runs the XSQLRequestSample program gets an output that looks like the one above and cannot understand why his parameters that are being passed to the XSQLRequest class aren't getting used correctly. The answer is, they are getting passed correctly but by the time the XSQLRequest class sees the page for processing, the page is not the same page you think you're getting!
    The ways to avoid this problem are:
    [list=1]
    [*]Use a file:// URL to reference the XSQL page template.
    [*]Change the extension on the file served by your webserver to anything besides *.xsql. For example, renaming dano.registrar.xsql to dano.registrar.xyz would work)
    [list]
    Hopefully this helps explains a lot of mysteries that people have run into.

    Thank you, that does explain a lot.
    It does present the problem, that it is not possible to use the same XSQL file from a <jsp:include> statement and from the API ...
    Cheers,
    Morten

  • Problems connecting with database from java API

    I've benn using XSQLRequest and I found a problem with
    connections, because it can't connect from Java to database, but
    if I access to a .xsql it works.
    And also if I link to a .xsql first and after that I try to
    access to Database form my servlet it works. So I think my
    problem is to initialize the XSQLConfig.xml file in OC4J server.
    Thanks in advance

    Would you provide the way you deploy your XSQL app to OC4J and
    how you get JDBC connection using JAVA? I execute the next code more or less:
    miXSQLRequest = new XSQLRequest(XSQLQuery.getDOM
    (),null);
    miXSQLRequest.process(htParamsIn, pWriter, pErrors);
    but and it's probabily my mistake I don't get any conecction
    from the session or something similar because I thought that
    it's made by XSQLRequest, and the XSQLRequest class takes the
    default values of the connection pool from the file
    XSQLConfig.xml (I put this file inside the lib directory of
    OC4J) as the XSQLServlet.
    Thanks for your help

  • XSQLRequest connection error

    I'm working on creating a servlet that executes a XSQL document that only exists in memory. The goal is to have the XSQL stored in a database or dynamicly generated. I'm having a problem getting a XSQL page that needs a database connection to work correctly.
    Here is the code I'm working on right now:
    StringBuffer errorBuilder = new StringBuffer();
    Dictionary params = new Hashtable();
    params.put("test", "MyTestParam");
    StringBuffer xsqlDocBuilder = new StringBuffer();
    xsqlDocBuilder.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    xsqlDocBuilder.append("<page xmlns:xsql=\"urn:oracle-xsql\" connection=\"buck\">");
        xsqlDocBuilder.append("<test>data</test>");
        xsqlDocBuilder.append("<xsql:current-date/>");
        xsqlDocBuilder.append("<xsql:param name=\"test\"/>");
    xsqlDocBuilder.append("</page>");
    DOMParser parser = new DOMParser();
    try
        parser.parse(new BufferedReader(new StringReader(xsqlDocBuilder.toString())));
    catch (Exception ioe)
        errorBuilder.append("Error parsing XML String:\n");
        errorBuilder.append(ioe);
    XMLDocument xDoc = parser.getDocument();
    XSQLRequest req = new XSQLRequest(xDoc, null);
    XMLDocument xsqlDoc = (XMLDocument)req.processToXML(params);
    XMLPrintDriver pDriver = new XMLPrintDriver(System.out);
    try
        pDriver.printDocument(xsqlDoc);
    catch (Exception e)
        System.out.println("Error printing document to stdout:\n" + e);
    If I remove the "<xsql:current-date/>" action and the connection name it executes correctly. Adding the database dependent information gives me this error:
    Oracle XSQL Custom Page Processor 9.0.3.0.0 (Production)
    XSQL-017: Unexpected Error Occurred
    java.lang.NullPointerException
        at oracle.xml.xsql.XSQLPageRequestImpl.getXSQLConnectionManager(XSQLPageRequestImpl.java:477)
        at oracle.xml.xsql.XSQLPageRequestImpl.setConnectionName(XSQLPageRequestImpl.java:281)
        at oracle.xml.xsql.XSQLPageProcessor.processToXML(XSQLPageProcessor.java:426)
        at oracle.xml.xsql.XSQLRequest.processToXML(XSQLRequest.java:423)
        at oracle.xml.xsql.XSQLRequest.processToXML(XSQLRequest.java:369)
        at edu.mtu.uportal.channels.dbTest.dbTest.renderXML(dbTest.java:98)
        at org.jasig.portal.ChannelRenderer$Worker.run(ChannelRenderer.java:523)
        at org.jasig.portal.utils.threading.Worker.run(Worker.java:88)
    The same XSQL I am creating in the servlet executes fine via the command line interface using the exact same XSQLConfig.xml file. The XSQLConfig.xml file is obviously being used since the param action handler works correctly. Any ideas on what I'm doing wrong would be much appreciated.
    One last note, my baseURL for creating the XSQLRequest is null but passing a valid URL changes nothing.
    -Eric Dalquist

    Get a XSQLRequest object with the constructor with XSQLConnectionManagerFactory as a parameter.
    XSQLDatasourceConnectionManager datasourceConnMgr=new XSQLDatasourceConnectionManager();
    XSQLConnectionManagerFactory connMgrFactory=(XSQLConnectionManagerFactory)datasourceConnMgr;
    XSQLRequest req=new XSQLRequest(connMgrFactory, xDoc, null);

  • Documentation for XSQLRequest class

    Where can I find documentation for the XSQLRequest java class?
    I have code that attempts to process an XSQL page as follows:
    XSQLRequest xsqlReq = new XSQLRequest(pageURL);
    xsqlReq.process(params,pwOutput,pwError);
    I'm getting the "out of memory" error that has been reported by others - looks like I'll have to figure out how to use SAX instead of DOM, but I first want to understanding what's going on with the existing code.

    Steve,
    Thanks for the info. The problem is the amount of data that is retreived. I can make it work by reducing the amount of data retrieved, but as I increase the amount of data, it eventually fails.
    Is there any straight forward solution? It's so easy and convenient using the XSQL page processor via XSQLRequest - I'd hate to have to abandon it.
    Thanks,
    Matt
    PS - Great book!!!

  • Problems configuring for xdk9.2.0.2.0

    I have been using XDK9011A for a while without any problems. I just downloaded and tried but iam getting the following and iam unable to run any of my xsql pages properly.
    I hope this is a problem in configuration. Can any one help me out. Please the the error log given below...
    [08/Aug/2002 10:30:09:7] error: Exception: SERVLET-execution_failed: Error in executing servlet controller: java.lang.NoSuchMethodError: org.w
    3c.dom.Node: method normalize()V not found
    Exception Stack Trace:
    java.lang.NoSuchMethodError: org.w3c.dom.Node: method normalize()V not found
    at oracle.xml.xsql.XSQLConfigManager.reloadConfigFile(Compiled Code)
    at oracle.xml.xsql.XSQLConfigManager.insureConfigurationIsLoaded(XSQLConfigManager.java:191)
    at oracle.xml.xsql.XSQLPageManager.getPage(XSQLPageManager.java:73)
    at oracle.xml.xsql.XSQLPageRequestImpl.getXSQLPage(XSQLPageRequestImpl.java:454)
    at oracle.xml.xsql.XSQLPageProcessor.processToXML(Compiled Code)
    at oracle.xml.xsql.XSQLRequest.processToXML(XSQLRequest.java:423)
    at oracle.xml.xsql.XSQLRequest.processToXML(XSQLRequest.java:359)
    at com.sp.fwk.golden.util.xsql.XSQLHandler.ProcessToXML(Unknown Source)
    at com.sp.structuredfinance.business.GenericBusiness.ProcessToXML(Unknown Source)
    at com.sp.structuredfinance.presentation.request.GenericRequest.doProcess(Unknown Source)
    at com.sp.fwk.golden.presentation.PresentationRequest.processRequest(Unknown Source)
    at com.sp.fwk.golden.presentation.RequestTranslator.processRequest(Unknown Source)
    at com.sp.fwk.golden.presentation.FwkServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown Source)
    Thanks
    Veera

    > Nview?...how do i disable that?
    Well, I can tell you what I did but don't know whether it will help. I haven't encountered your problem but have just started playing with the correction brush.
    Every time I install a new program, I look through the list of services and started tasks to see what I can turn off to free memory and/or because it doesn't actually provide a useful service. My notes for NVidia say I disabled four items that I thought I didn't need:
    I disabled three started programs: NVCplDaemon, NVMediaCenter, and nwiz.exe from HKLM. I use the Startup Control Panel applet to disable the started programs, but there are other techniques including msconfig. I set the Set Nvidia Service to Manual (by Control Panel > Administrative Tools > Computer Management > Services).
    I just googled NVCplDaemon and found a discussion that recommended what I did: http://forums.guru3d.com/showthread.php?t=184662
    I have a 7600 GT card.

  • A problem with threads

    I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
    Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
    My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
    Thank you in advance,
    Lefty

    This was one solution from the socket programming forum, have you tried this??
    public Thread MyThread extends Thread{
         boolean active = true;          
         public void run(){
              ss.setSoTimeout(90);               
              while (active){                   
                   try{                       
                        serverSocket = ss.accept();
                   catch (SocketTimeoutException ste){
                   // do nothing                   
         // interrupt thread           
         public void deactivate(){               
              active = false;
              // you gotta sleep for a time longer than the               
              // accept() timeout to make sure that timeout is finished.               
              try{
                   sleep(91);               
              }catch (InterruptedException ie){            
              interrupt();
    }

  • A problem with Threads and MMapi

    I am tring to execute a class based on Game canvas.
    The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
    The MIDI tone "Stammers".
    How to over come the problem?
    Thanks in advance
    Kobi
    See Code example below:
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    public class MainScreenCanvas extends GameCanvas implements Runnable {
         private MainMIDlet parent;
         private boolean mTrucking = false;
         Image imgBackgound = null;
         int imgBackgoundX = 0, imgBackgoundY = 0;
         Player player;
         public MainScreenCanvas(MainMIDlet parent)
              super(true);
              this.parent = parent;
              try
                   imgBackgound = Image.createImage("/images/area03_bkg0.png");
                   imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
                   imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
              catch(Exception e)
                   System.out.println(e.getMessage());
          * starts thread
         public void start()
              mTrucking = true;
              Thread t = new Thread(this);
              t.start();
          * stops thread
         public void stop()
              mTrucking = false;
         public void play()
              try
                   InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
                   player = Manager.createPlayer(is, "audio/midi");
                   player.setLoopCount(-1);
                   player.prefetch();
                   player.start();
              catch(Exception e)
                   System.out.println(e.getMessage());
         public void run()
              Graphics g = getGraphics();
              play();
              while (true)
                   tick();
                   input();
                   render(g);
          * responsible for object movements
         private void tick()
          * response to key input
         private void input()
              int keyStates = getKeyStates();
              if ((keyStates & LEFT_PRESSED) != 0)
                   imgBackgoundX++;
                   if (imgBackgoundX > 0)
                        imgBackgoundX = 0;
              if ((keyStates & RIGHT_PRESSED) != 0)
                   imgBackgoundX--;
                   if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
                        imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
          * Responsible for the drawing
          * @param g
         private void render(Graphics g)
              g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
              this.flushGraphics();
    }

    You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
    However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
    You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
    Regds,
    SD
    N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
    Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM

  • J2ME problem with threads

    Hi all,
    I would like to ask you for a help. I need to write a small program at my university. I started to write a midlet which function would be to countdown time for sports activities. I woul like to start a new thread - the one that counts down - and at the same time make the main thread sleep. After the "countdown" thread finishes, the main thread wakes up and waits for user input. The problem is that when the "countdown" thread finishes his work, I've got Uncaught exception java/lang/NullPointerException. error and the midlet halts.
    Below you can find the code
    import java.lang.*;
    import java.util.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class intervals extends MIDlet implements CommandListener
    public Display ekran;
    private SweepCanvas sweeper;
    private Form rundy;
    private TextField round0, round1, round2, round3, round4, round5, round6, round7, round8;
    private long czas,x;
    private Command exitCommand;
    private Command addRound;
    private Command delRound;
    private Command start;
    private TextField repeat;
    private Form odliczanie;
    private Alert ostrz;
    Licznik thread;
    String test;
    StringItem test1;
    int parz,i,j,k;
    static int l;
    int ilrund;
    int ilpowt;
    Item sec;
    long sec1;
    public intervals()
        rundy = new Form("Interwa&#322;y sportowe");
        exitCommand = new Command("Wyj&#347;cie", Command.EXIT, 2);
        addRound = new Command("Dodaj","Dodaj rund&#281;", Command.ITEM,1);
        delRound = new Command("Usu&#324;","Usu&#324; ostatni&#261; rund&#281;", Command.ITEM,1);
        start = new Command("Start", Command.ITEM,1);
        odliczanie = new Form("Odliczanie");
        TextField dodaj(TextField kolej)
            kolej=new TextField("Podaj czas (s) rundy "+parz,null, 4, TextField.NUMERIC);//stworzenie nowej instancji do wybierania czasu trwania rundy
            if(rundy.size()==0)
                rundy.insert(rundy.size(),kolej);
                else
                    rundy.insert(rundy.size()-1, kolej);
            return kolej;
        void odliczanie(TextField round)
            monitor m=new monitor();
            k=Integer.parseInt(round.getString());
            ekran.setCurrent(odliczanie);
            thread=new Licznik(k,odliczanie);
            thread.start();
            ekran.setCurrent(rundy);
    public void startApp()// throws MIDletStateChangeException
        rundy.deleteAll();
        repeat = new TextField("Podaj ilo&#347;&#263; powtórze&#324;",null,1,TextField.NUMERIC);
        rundy.addCommand(addRound);
        rundy.addCommand(exitCommand);
        rundy.setCommandListener(this);
        Canvas obrazek = new MyCanvas();
        ekran = Display.getDisplay(this);
        ekran.setCurrent(obrazek);
        czas=System.currentTimeMillis();
        while (System.currentTimeMillis()<czas+1000)
            continue;
        ekran.setCurrent(rundy);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
        notifyDestroyed();
    public void commandAction(Command c, Displayable s)
        if (c == exitCommand)
            destroyApp(false);
            notifyDestroyed();
        else if(c==addRound)
            if(rundy.size()==0)//Sprawdzenie ilo&#347;ci elementów w celu poprawnego wy&#347;wietlania liczby rund w formie
                parz=1;
                else
                parz=rundy.size();
            switch(parz)
                case 1:
                    round0=dodaj(round0);break;
                case 2:
                    round1=dodaj(round1);break;
                case 3:
                   round2= dodaj(round2);break;
                case 4:
                    round3=dodaj(round3);break;
                case 5:
                    round4=dodaj(round4);break;
                default:
                    ostrz=new Alert("Uwaga","Maksymalna liczba rund wynosi 9", null, AlertType.INFO);
                    ostrz.setTimeout(3000);
                    ekran.setCurrent(ostrz);
            if(rundy.size()==1)
                rundy.append(repeat);
                rundy.addCommand(start);
            rundy.addCommand(delRound);
        else if(c==delRound)
            if(rundy.size()!=0)
                rundy.delete(rundy.size()-2);
                if (rundy.size()==1)
                    rundy.deleteAll();
                if(rundy.size()==0)
                    rundy.removeCommand(delRound);
                    rundy.removeCommand(start);
        else if(c==start)
            ilrund=rundy.size()-1;
            if(this.repeat.size()>0)
                ilpowt=Integer.parseInt(this.repeat.getString());
            ekran = Display.getDisplay(this);
            for (i=1; i<=ilpowt;i++)
                odliczanie= new Form("Odliczanie");
                 for (j=0;j<ilrund;j++)
                    switch(j)
                         case 0:
                             odliczanie(round0);
                             break;
                         case 1:
                             odliczanie(round1);
                             break;
                         case 2:
                             odliczanie(round2);
                             break;
                         case 3:
                             odliczanie(round3);
                             break;
                         case 4:
                             odliczanie(round4);
                             break;
                         case 5:
                             odliczanie(round5);
                             break;
                         case 6:
                             odliczanie(round6);
                             break;
                         case 7:
                             odliczanie(round7);
                             break;
                         case 8:
                             odliczanie(round8);
                             break;
    class Licznik extends Thread
        int czas1,k;
        Form forma;
        monitor m;
        public Licznik(int k,Form formap)
            czas1=k;
            forma=formap;
        public synchronized void run()
            while(czas1>0)
                forma.deleteAll();
                forma.append("Czas pozosta&#322;y (s): "+czas1);
                try{Thread.sleep(1000);} catch(InterruptedException e){e.printStackTrace();}
                czas1--;
            if(czas1<=0)
                m.put();
        }and monitor class
    public class monitor
    boolean busy=false;
    synchronized void get()
        if(!busy)
            try
                wait();
            }catch(InterruptedException e){e.printStackTrace();}
        notify();
    synchronized void put()
        if(busy)
            try
            wait();
            }catch(InterruptedException e){e.printStackTrace();}
        busy=true;
        notify();
    }Can anybody help me with this?

    Groovemaker,
    Your Licznik class has a member m of type monitor, which has not been instantiated (in other words is null) hence, when calling m.put() you get NullPointerException. Please also mind, that using Thread.sleep(1000) is not an accurate way of measuring time.
    If I may, please use recommended for Java class naming conventions - some of your names use lower case, while other don't which is confusing to the reader.
    Daniel

  • Problem with threads within applet

    Hello,
    I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
    this thread is running in endless loop.
    he is doing something and go to sleep on and on.
    the problem is,
    when I refresh my IE6 browser I see more than 1 thread.
    for debug matter, I did the following things:
    inside the thread, sysout every time he goes to sleep.
    sysout in the singleton constructor.
    sysout in the singleton destructor.
    the output goes like this:
    when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
    The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
    The destructor never works (no output there).
    I don't understand what is going on.
    someone can please shed some light?
    thanks.
    btw. I am working with JRE 1.1
    this is very old and big applet and I can't convert it to something new.

    Ooops. sorry!
    I did.
         public void start() {
         public void stop() {
         public void destroy() {
              try {
                   resetAll();
                   Configuration.closeConnection();
                   QuoteItem.closeConnection();
              } finally {
                   try {
                        super.finalize();
                   } catch (Throwable e) {
                        e.printStackTrace();
         }

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

Maybe you are looking for