Converting java.lang.String to a XML Node

Hi,
how do you convert a straight forward string like ..
"<nodename>this is the node value</nodename>" to a org.w3c.dom.Node....??
This way it would be easier to use appendNode() to add temporary nodes & build up a document.

ur app will perform poor if u r going to instantiate
Document builder often.and u cant append the node ,like
the way u r trying do.
the node has to belong to the same document.
u have to necessarily create node/text node, from this document and append it .
Option two: read content from 1 file as a string append
the second value from dealer_info and then create a document from the result String.but make sure ur string is in valid XML format.
HTH
vasanth-ct
Ok let me tell you what exactly i want to do, so that
you can advise me better. Please tell me, what could
be done to avoid the error below.
//start from an existing template xml file
Document d =
parseXmlFile("D:/www/Detailcache/detail.xml", false);
Node root=d.getFirstChild();
//append dealer information to the root node
Node dnode=getDealerInfo(currentDealer);
System.out.println("Node
Info-->"+dnode.getNodeName());
root.appendChild(dnode);
//<-------------------Line175
//Dealerinfo module returning the parent node
public Node getDealerInfo(DealerInfo currentDealer) {
try {
DocumentBuilderFactory factory =
ctory = DocumentBuilderFactory.newInstance();
String
String dealer_info="<dealer_info><dealer_address>930
Rockbridge
ave</dealer_address><dealer_country>USA</dealer_countr
</dealer_info>";byte buf[] = dealer_info.getBytes();
ByteArrayInputStream in = new
n = new ByteArrayInputStream(buf);
BufferedInputStream bis = new
s = new BufferedInputStream(in);
Document dealer_info_doc =
o_doc = factory.newDocumentBuilder().parse(bis);
Node dealer_info_node=
o_node= dealer_info_doc.getFirstChild();
return dealer_info_node;
} catch (Exception e) {e.printStackTrace();}
return null;
My problem is 'root.appendChild(dnode);' returns an
error :
Node Info-->dealer_info
org.apache.crimson.tree.DomEx: WRONG_DOCUMENT_ERR:
That node doesn't belong in this document.
at
org.apache.crimson.tree.ParentNode.checkDocument(Unkno
n Source)
at
org.apache.crimson.tree.ParentNode.appendChild(Unknown
Source)
at
com.boatventures.inventory.servlet.XmlServlet.showPage
XmlServlet.java:175)
at
com.boatventures.inventory.servlet.XmlServlet.doGet(Xm
Servlet.java:64)
at
javax.servlet.http.HttpServlet.service(HttpServlet.jav
:740)
at
javax.servlet.http.HttpServlet.service(HttpServlet.jav
:853)
at
allaire.jrun.servlet.JRunSE.service(JRunSE.java:1417)
at
allaire.jrun.session.JRunSessionService.service(JRunSe
sionService.java:1106)
at
allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:127
at
allaire.jrun.servlet.JRunNamedDispatcher.forward(JRunN
medDispatcher.java:39)
at
allaire.jrun.servlet.Invoker.service(Invoker.java:84)
at
allaire.jrun.servlet.JRunSE.service(JRunSE.java:1417)
at
allaire.jrun.session.JRunSessionService.service(JRunSe
sionService.java:1106)
at
allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:127
at
allaire.jrun.servlet.JRunRequestDispatcher.forward(JRu
RequestDispatcher.java:89)
at
allaire.jrun.servlet.JRunSE.service(JRunSE.java:1557)
at
allaire.jrun.servlet.JRunSE.service(JRunSE.java:1547)
at
allaire.jrun.servlet.JvmContext.dispatch(JvmContext.ja
a:364)
at
allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java
388)
     at allaire.jrun.ThreadPool.run(ThreadPool.java:272)
at
allaire.jrun.WorkerThread.run(WorkerThread.java:75)

Similar Messages

  • Cannot convert type class java.lang.String to class oracle.jbo.domain.Clob

    Cannot convert type class java.lang.String to class oracle.jbo.domain.ClobDomain.
    Using ADF Business Components I have a JSFF page fragment with an ADF form based on a table with has a column of type CLOB. The data is retrieved from the database and displayed correctly but when any field is changed and submitted the above error occurs. I have just used the drag and drop technique to create the ADF form with a submit button, am I missing a step?
    I am using the production release of Jdeveloper11G

    Reproduced and filed bug# 7487124
    The workaround is to add a custom converter class to your ViewController project like this
    package oow2008.view;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import oracle.jbo.domain.ClobDomain;
    import oracle.jbo.domain.DataCreationException;
    public class ClobConverter implements Converter {
         public Object getAsObject(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   String string) {
           try {
             return string != null ? new ClobDomain(string) : null;
           } catch (DataCreationException dce) {
             dce.setAppendCodes(false);
             FacesMessage fm =
               new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                "Invalid Clob Value",
                                dce.getMessage());
             throw new ConverterException(fm);
         public String getAsString(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   Object object) {
           return object != null ?
                  object.toString() :
                  null;
    }then to register the converter in faces-config.xml like this
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
      <application>
        <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
      </application>
      <converter>
        <converter-id>clobConverter</converter-id>
        <converter-class>oow2008.view.ClobConverter</converter-class>
      </converter>
    </faces-config>then reference this converter in the field for the ClobDomain value like this
              <af:inputText value="#{bindings.Description.inputValue}"
                            label="#{bindings.Description.hints.label}"
                            required="#{bindings.Description.hints.mandatory}"
                            columns="40"
                            maximumLength="#{bindings.Description.hints.precision}"
                            shortDesc="#{bindings.Description.hints.tooltip}"
                            wrap="soft" rows="10">
                <f:validator binding="#{bindings.Description.validator}"/>
                <f:converter converterId="clobConverter"/>
              </af:inputText>

  • Changing java.lang.String default converter

    JSF by default assign empty string at backing bean properties when a form is sent. I want to override that with a custom converter. My problem is my converter is never called. This is the code at faces-config.xml:
            <converter>
              <converter-for-class>java.lang.String</converter-for-class>
              <converter-class>
                   myPackage.NullableStringConverter
              </converter-class>
         </converter>If I set breakpoints inside getAsObject or getAsString I see it doesn't stops there. What am I doing wrong?

    You'll need to migrate to JSF 1.2 in order to accomplish what you're trying. If I recall correctly, 1.1 will ignore converters for String.

  • Cannot convert ÿØÿà of type class java.lang.String to class BFileDomain.

    Hi All,
    I am using Jdeveloper 11.1.2.3.0.
    I have a scenario of making an ADF page where I have a IMAGE field to show on the page. So,I have a table called "PRODUCT" with fields called photo with BFILE type. Now when I the data i have inserted using the DML command and i can see the path at the backend.
    However,when i am runnig my ADF page in the Filed called "PHOTO" I can only see a junk character stating 'yoyo'.
    When I click on it, it says ERROR "Cannot convert ÿØÿà of type class java.lang.String to class oracle.jbo.domain.BFileDomain".
    Your help will be appreciated ASAP.
    Regards,
    Shahnawaz

    Hi,
    did you show the id-value in the user interface as a input-component, and did the input-component include a converter?
    If yes, show the id as output-text and remove any existing converter-components.
    Best Regards

  • Java.lang.NoSuchMethodError: com.sun.xml.ws.util.JAXWSUtils.getEncodedURL(Ljava/lang/String;)Ljava/net/URL;

    java.lang.NoSuchMethodError: com.sun.xml.ws.util.JAXWSUtils.getEncodedURL(Ljava/lang/String;)Ljava/net/URL.
    Gettin exception while trying to execute clientGen from build.xml from eclipse using Oracle weblogic 10.3 server.
    I tried with both jars jaxws-rt-2.1.4 and jaxws-rt-2.1.3
    Regards,
    Manish

    along with wlfullclient.jar please add wseeclient.jar
    Copy the file WL_HOME/server/lib/wseeclient.zip from the computer hosting WebLogic Server to the client computer( where WL_HOME refers to the WebLogic Server installation directory, such as /Oracle/Middleware/wlserver_12.1)
    Unzip the wseeclient.zip file into the appropriate directory. For example, you might unzip the file into a directory that contains other classes used by your client application.
    Add the wseeclient.jar file (unzipped from the wseeclient.zip file) to your CLASSPATH.
    Note:
    Also be sure that your CLASSPATH includes the JAR file that contains the Ant classes (ant.jar). This JAR file is typically located in the lib directory of the Ant distribution.
    http://docs.oracle.com/cd/E24329_01/web.1211/e24967/client.htm#WSRPC214
    Regards,
    Sunil P

  • Incompatible types - found java.lang.String but expected int

    This is an extremely small simple program but i keep getting an "incompatible types - found java.lang.String but expected int" error and dont understand why. Im still pretty new to Java so it might just be something stupid im over looking...
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Lab
    public static void main(String []args)
    int input = JOptionPane.showInputDialog("Input Decimal ");
    String bin = Integer.toBinaryString(input);
    String hex = Integer.toHexString(input);
    System.out.println("Decimal= " + input + '\n' + "Binary= " + bin + '\n' + "Hexadecimal " + hex);
    }

    You should always post the full, exact error message.
    Your error message probably says that the error occurred on something like line #10, the JOptionPane line. The error is telling you that the compiler found a String value, but an int value was expected.
    If you go to the API docs for JOptionPane, it will tell you what value type is returned for showInputDialog(). The value type is String. But you are trying to assign that value to an int. You can't do that.
    You will need to assign the showInputDialog() value to a String variable. Then use Integer.parseInt(the_string) to convert to an int value.

  • Problem in java.lang.String.format()

    Dear Experts,
    I tried to display a double value with leading spaces with the following statements:
    double val = 123456789.987654321;
    System.out.println( String.format("%17.2f", val));They worked in void main(), but didn't in a method of a class. The following error message was found while compiling:
    init:
    deps-jar:
    Compiling 1 source file to C:\JavaProject\ALC-EJB\build\jar
    C:\JavaProject\ALC-EJB\src\java\escis\creditControl\BalanceRecord.java:61: cannot find symbol
    symbol  : method format(java.lang.String,double)
    location: class java.lang.String
            System.out.println( String.format("%17.2f", val));
    1 error
    C:\JavaProject\ALC-EJB\nbproject\build-impl.xml:223: The following error occurred while executing this line:
    C:\JavaProject\ALC-EJB\nbproject\build-impl.xml:109: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 2 seconds)I've read the mentioned file (build-impl.xml) but still got no idea what happened.
    Line 109:
    <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">Line 223:
    <ejbjarproject2:javac>I'm using NetBeans IDE 4.1. Could you please give me a hand? Thank you very much

    Not sure if this has got anything to do with it, but
    the format() method was added to String in Java 5.0.
    Maybe you are using an older version in that second
    case?You're right. It works when I've changed it from 1.4 (default) to 1.5. Thank you very much.

  • Exception in thread "main" java.lang.NoSuchMethodError: com.sun.xml.wss.con

    Hi everyone,
    Just now i tried to run the 'simple' example in an JAXRPC Security part in the JWSDP 1.4 tutorial but got the following error:
    run-sample:
    [echo] Running the simple.TestClient program....
    [java] Service URL=http://localhost:8080/securesimple/Ping
    [java] Exception in thread "main" java.lang.NoSuchMethodError: com.sun.xml.wss.configuration.SecurityConfigurationXmlReader.readJAXRPCSecurityConfigurationString(Ljava/lang/String;Z)Lcom/sun/xml/wss/configuration/JAXRPCSecurityConfiguration;
    [java]      at com.sun.xml.rpc.security.SecurityPluginUtil.<init>(SecurityPluginUtil.java:128)
    [java]      at simple.PingPort_Ping_Stub.<clinit>(PingPort_Ping_Stub.java:40)
    [java]      at simple.PingService_Impl.getPing(PingService_Impl.java:68)
    [java]      at simple.TestClient.main(TestClient.java:27)
    Can anybody give me a clue?

    Vishal, thanks a lot for your reply. I used the App Server 2004Q4 beta and got the problem. When I switch to version 8.0.0_01 the things work well.
    But now I'm trying to understand this example and creating my own simple web app using encryption feature. From the files in the example dicrectory I can figure out the security applied at client by examining client stub files generated by the wscompile in the asant gen-client task. But I wonder when security is added to the server side. Is it when we use wsdeploy with the model part specifiedin jaxrpc-ri.xml? What is the procedure to apply the security to the web service?
    The last thing I want to ask is whether the deploytool bundled inside App Server can do the same things as ant task (eg. wsdeploy with some arguments).

  • Help with StuckThread in java.lang.String.equals(String.java:619)

    I periodically get a stuck Execute thread on my Weblogic 8.15 server
    during a call to a Stateless Session Bean. When I do thread dumps, the
    thread is always stuck in the same place (in
    java.lang.String.equals(String.java:619) or in the call immediately above it
    java.util.LinkedList.indexOf(LinkedList.java:397)). Even though the thread
    dump indicates that the thread is in a runnable state, if I do multiple
    thread dumps over a period of time, the stack trace always indicates that
    the thread is in the same place. The thread remains stuck until Weblogic is
    restarted. Other client applictions can make session bean calls, but each
    stuck thread seems to still take up lots of CPU time. I have let the stuck
    threads run overnight, and the stack trace from the thread dump always shows
    them executing the same String/LinkedList code. In each case, our code is
    trying to iterate over a collection
    Does anybody know what could cause this problem, and how to fix it? I get
    StuckThreadMaxTime errors in the log:
    ####<Dec 4, 2005 10:47:25 AM EST> <Error> <WebLogicServer> <nybill>
    <myserver> <weblogic.health.CoreHealthMonitor> <<WLS Kernel>> <>
    <BEA-000337> <ExecuteThread: '4' for queue: 'weblogic.kernel.Default' has
    been busy for "1,263" seconds working on the request
    "ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl", which
    is more than the configured time (StuckThreadMaxTime) of "1,200" seconds.>
    Here are some stack traces from different thread dumps (I have the full
    thread dumps if necessary):
    "ExecuteThread: '10' for queue: 'weblogic.kernel.Default'" daemon prio=5
    tid=0x7720eb98 nid=0xd68 runnable [571f000..571fdb0]
    at java.lang.String.equals(String.java:619)
    at java.util.LinkedList.indexOf(LinkedList.java:398)
    at java.util.LinkedList.contains(LinkedList.java:176)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getDailyCallSummary(XMLBillCr
    eation.java:1992)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getGraphs(XMLBillCreation.jav
    a:1931)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getLocations(XMLBillCreation.
    java:2618)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.createXMLBill(XMLBillCreation
    .java:236)
    at
    ncss.billing.ejb.billAdmin.session.BillAdminSessionEJB.getBillAsXml(BillAdmi
    nSessionEJB.java:341)
    at
    ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl.getBillAsX
    ml(BillAdminSession_uli3xb_EOImpl.java:100)
    at
    ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl_WLSkel.inv
    oke(Unknown Source)
    at
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :108)
    at
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:363)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    "ExecuteThread: '22' for queue: 'weblogic.kernel.Default'" daemon prio=5
    tid=0x772538d0 nid=0xe24 runnable [497f000..4fdb0]
    at java.lang.String.equals(String.java:619)
    at java.util.LinkedList.indexOf(LinkedList.java:398)
    at java.util.LinkedList.contains(LinkedList.java:176)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getMostExpensiveOrLongestCall
    s(XMLBillCreation.java:1892)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getTopTenReport(XMLBillCreati
    on.java:1798)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getTopTenReports(XMLBillCreat
    ion.java:1751)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getLocations(XMLBillCreation.
    java:2612)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.createXMLBill(XMLBillCreation
    .java:236)
    at
    ncss.billing.ejb.billAdmin.session.BillAdminSessionEJB.getBillAsXml(BillAdmi
    nSessionEJB.java:341)
    at
    ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl.getBillAsX
    ml(BillAdminSession_uli3xb_EOIm.java:100)
    at
    ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl_WLSkel.inv
    oke(Unknown Source)
    at
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :108)
    at
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:363)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    "ExecuteThread: '21' for queue: 'weblogic.kernel.Default'" daemon prio=5
    tid=0x76afb060 nid=0x498 runnable [48af000..48fdb0]
    at java.lang.String.equals(String.java:619)
    at java.util.LinkedList.indexOf(LinkedList.java:398)
    at java.util.LinkedList.contains(LinkedList.java:176)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getMostFrequentlyCalledNumber
    sOrCitiesReport(XMLBillCreation.java:1839)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getTopTenReport(XMLBillCreati
    on.java:1772)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getTopTenReports(XMLBillCreat
    ion.java:1743)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.getLocations(XMLBillCreation.
    java:2612)
    at
    ncss.billing.broadviewBill.xml.XMLBillCreation.createXMLBill(XMLBillCreation
    .java:236)
    at
    ncss.billing.ejb.billAdmin.session.BillAdminSessionEJB.getBillAsXml(BillAdmi
    nSessionEJB.java:341)
    at
    ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl.getBillAsX
    ml(BillAdminSession_uli3xb_EOImp.java:100)
    at
    ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl_WLSkel.inv
    oke(Unknown Source)
    at
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :108)
    at
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:363)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    The code in LinkedList that it seems to be executing is the following:
    Line#
    397 for (Entry e = header.next; e != header; e = e.next) {
    398 if (o.equals(e.element))
    399 return index;
    400 index++;
    401 }
    I am running Weblogic 8.15 on Windows 2000.
    Thanks for any help,
    - Don

    njb7ty wrote:
    I suggest dropping that example program and concentrating on reading a book on Java such as 'Head First in Java'. Otherwise, you will spend a lot of time trying to get something to work and gain little value from it.Likewise... Jumping into reflections before you can [read a stack-trace|http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/] is like signing up a toddler for the New York Marathon... it's probably simply beyond your skill level... so step back... go read a book, do some tutorials, get your head around just the process of the designing, writing, compiling, running, and debugging java programs... and what the different diagnostics mean... Then, equipped with your nose-clip and your trusty stone ;-) you contemplate leaping into the deep end ;-)
    Cheers. Keith.

  • Method invokeMethod(java.lang.String, org.w3c.dom.Element) not found

    I am calling a Web Service that returns an XML-file. The XML-file should be passed to a method that puts the xml into a table in my database.
    I will upload the 3 files that are being used for this.
    When I rebuild my files I get the following error in CustomerCO.java:
    Error(78,38): method invokeMethod(java.lang.String, org.w3c.dom.Element) not found in interface oracle.apps.fnd.framework.OAApplicationModule
    Line 78 reads as follows:
    String Status = (String)am.invokeMethod("initSaveXml", wsXml);
    Any suggestions?
    PS: I am a newbie to java and framework :-(
    Here are my files:
    CustomerCO.java:
    /*===========================================================================+
    | Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA |
    | All rights reserved. |
    +===========================================================================+
    | HISTORY |
    +===========================================================================*/
    package xxcu.oracle.apps.ar.customer.server.webui;
    import java.io.Serializable;
    import java.lang.Exception;
    import oracle.apps.fnd.common.VersionInfo;
    import oracle.apps.fnd.framework.OAApplicationModule;
    import oracle.apps.fnd.framework.webui.OAControllerImpl;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import org.w3c.dom.Element;
    import xxcu.oracle.apps.ar.customer.ws.LindorffWS;
    * Controller for ...
    public class CustomerCO extends OAControllerImpl implements Serializable
    public static final String RCS_ID="$Header$";
    public static final boolean RCS_ID_RECORDED =
    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
    * Layout and page setup logic for a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    * Procedure to handle form submissions for form elements in
    * a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    * 2009.07.09, Roy Feirud, lagt til for å utføre spørring
    if (pageContext.getParameter("Search") != null)
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    //Setter søkekriteriene til LindorffWS
    String Name = pageContext.getParameter("SearchName");
    String Address = pageContext.getParameter("SearchAddress");
    String Zip = pageContext.getParameter("SearchZipCode");
    String City = pageContext.getParameter("SearchCity");
    String Born = pageContext.getParameter("SearchBorn");
    String Phone = pageContext.getParameter("SearchPhoneNo");
    Serializable[] param = { Name, Address, Zip, City, Born, Phone };
    //Bygger søkestrengen
    String SearchString = (String)am.invokeMethod("initBuildString", param );
    //Initialiserer LindorffWS
    LindorffWS WsConnection = new LindorffWS();
    try
    //Kaller Web Sevice fra Lindorff
    Element wsXml = (Element)WsConnection.XmlFulltextOperator(SearchString);
    String Status = (String)am.invokeMethod("initSaveXml", wsXml);
    catch(Exception WsExp)
    // WsConnection = new LindorffWS();
    System.out.println("Kall til LindorffWS feilet!");
    am.invokeMethod("initQueryCustomer");
    CustomerAMImpl.java:
    package xxcu.oracle.apps.ar.customer.server;
    import java.io.Serializable;
    import java.sql.CallableStatement;
    import java.sql.SQLException;
    import java.sql.Types;
    import oracle.apps.fnd.common.MessageToken;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
    import oracle.apps.fnd.framework.server.OADBTransaction;
    import oracle.apps.fnd.framework.server.OAExceptionUtils;
    import org.w3c.dom.Element;
    // --- File generated by Oracle Business Components for Java.
    public class CustomerAMImpl extends OAApplicationModuleImpl implements Serializable
    * This is the default constructor (do not remove)
    public CustomerAMImpl()
    * Sample main for debugging Business Components code using the tester.
    public static void main(String[] args)
    launchTester("xxcu.oracle.apps.ar.customer.server", "CustomerAMLocal");
    * Container's getter for CustomerVO1
    public CustomerVOImpl getCustomerVO1()
    return (CustomerVOImpl)findViewObject("CustomerVO1");
    * 2009.07.09, Roy Feirud, Lagt til for å utføre spørring.
    public void initQueryCustomer()
    CustomerVOImpl vo = getCustomerVO1();
    if (vo!=null)
    vo.initQuery();
    * 2009.08.31, Roy Feirud, Lagt til for å bygge opp input til WebService hos Lindorff.
    public String initBuildString(String Name
    ,String Address
    ,String Zip
    ,String City
    ,String Born
    ,String Phone)
    String ws_string = null;
    CallableStatement cs = null;
    try
    String sql= "BEGIN ISS_WS_LINDORFF_PKG.BUILD_STRING (?,?,?,?,?,?,?); END;";
    OADBTransaction txn = getOADBTransaction();
    cs = txn.createCallableStatement(sql,1);
    cs.setString(1,Name);
    cs.setString(2,Address);
    cs.setString(3,Zip);
    cs.setString(4,City);
    cs.setString(5,Born);
    cs.setString(6,Phone);
    cs.registerOutParameter(7,Types.VARCHAR);
    cs.execute();
    OAExceptionUtils.checkErrors (txn);
    ws_string = cs.getString(7);
    cs.close();
    catch (SQLException sqle)
    String Prosedyre = "ISS_WS_LINDORFF_PKG.BUILD_STRING";
    String Errmsg = sqle.toString();
    MessageToken[] tokens = {new MessageToken("PROSEDYRE", Prosedyre), new MessageToken("ERRMSG", Errmsg)};
    throw new OAException("ISS", "ISS_PLSQL_ERROR",tokens,OAException.ERROR, null);
    return ws_string;
    public String initSaveXml(Element WsXml)
    String Status = "Error";
    CallableStatement cs = null;
    try
    String sql= "BEGIN ISS_XML2TABLE_PKG.ISS_AR_CUSTOMERS_TMP (?,?); END;";
    OADBTransaction txn = getOADBTransaction();
    cs = txn.createCallableStatement(sql,1);
    cs.setObject(1,WsXml);
    cs.registerOutParameter(2,Types.VARCHAR);
    cs.execute();
    OAExceptionUtils.checkErrors (txn);
    Status = cs.getString(2);
    cs.close();
    catch (SQLException sqle)
    String Prosedyre = "ISS_XML2TABLE_PKG.ISS_AR_CUSTOMERS_TMP";
    String Errmsg = sqle.toString();
    MessageToken[] tokens = {new MessageToken("PROSEDYRE", Prosedyre), new MessageToken("ERRMSG", Errmsg)};
    throw new OAException("ISS", "ISS_PLSQL_ERROR",tokens,OAException.ERROR, null);
    return Status;
    LindorffWS.java:
    package xxcu.oracle.apps.ar.customer.ws;
    import oracle.soap.transport.http.OracleSOAPHTTPConnection;
    //import org.apache.soap.encoding.soapenc.BeanSerializer;
    import org.apache.soap.encoding.SOAPMappingRegistry;
    //import org.apache.soap.util.xml.QName;
    import java.util.Vector;
    import org.w3c.dom.Element;
    import java.net.URL;
    import org.apache.soap.Body;
    import org.apache.soap.Envelope;
    import org.apache.soap.messaging.Message;
    import oracle.jdeveloper.webservices.runtime.WrappedDocLiteralStub;
    * Generated by the Oracle9i JDeveloper Web Services Stub/Skeleton Generator.
    * Date Created: Fri Jul 10 10:37:21 CEST 2009
    * WSDL URL: http://services.lindorffmatch.com/Search/Search.asmx?WSDL
    public class LindorffWS extends WrappedDocLiteralStub
    public LindorffWS()
    m_httpConnection = new OracleSOAPHTTPConnection();
    public String endpoint = "http://services.lindorffmatch.com/Search/Search.asmx";
    private OracleSOAPHTTPConnection m_httpConnection = null;
    private SOAPMappingRegistry m_smr = null;
    public Element XmlFulltextOperator(String xmlString) throws Exception
    URL endpointURL = new URL(endpoint);
    Envelope requestEnv = new Envelope();
    Body requestBody = new Body();
    Vector requestBodyEntries = new Vector();
    String wrappingName = "XmlFulltextOperator";
    String targetNamespace = "http://services.lindorffmatch.com/search";
    Vector requestData = new Vector();
    requestData.add(new Object[] {"xmlString", xmlString});
    requestBodyEntries.addElement(toElement(wrappingName, targetNamespace, requestData));
    requestBody.setBodyEntries(requestBodyEntries);
    requestEnv.setBody(requestBody);
    Message msg = new Message();
    msg.setSOAPTransport(m_httpConnection);
    msg.send(endpointURL, "http://services.lindorffmatch.com/search/XmlFulltextOperator", requestEnv);
    Envelope responseEnv = msg.receiveEnvelope();
    Body responseBody = responseEnv.getBody();
    Vector responseData = responseBody.getBodyEntries();
    return (Element)fromElement((Element)responseData.elementAt(0), org.w3c.dom.Element.class);
    _______________________________________________________________________________________________________________________________

    Hi,
    Create an Interface to your application Module then from interface call your method,
    refer http://www.oraclearea51.com/oracle-technical-articles/oa-framework/oa-framework-beginners-guide/213-how-to-call-am-methods-from-controller-without-using-invokemethod.html for creating Interface for AM and calling it in controller.
    Regards,
    Reetesh Sharma

  • Jdev: method invokeMethod(java.lang.String, org.w3c.dom.Element) not found

    I am calling a Web Service that returns an XML-file. The XML-file should be passed to a method that puts the xml into a table in my database.
    I will upload the 3 files that are being used for this.
    When I rebuild my files I get the following error in CustomerCO.java:
    Error(78,38): method invokeMethod(java.lang.String, org.w3c.dom.Element) not found in interface oracle.apps.fnd.framework.OAApplicationModule
    Line 78 reads as follows:
    String Status = (String)am.invokeMethod("initSaveXml", wsXml);
    Any suggestions?
    PS: I am a newbie to java and framework
    Here are my files:
    CustomerCO.java:
    /*===========================================================================+
    Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA
    All rights reserved.
    ===========================================================================
    HISTORY
    +===========================================================================*/
    package xxcu.oracle.apps.ar.customer.server.webui;
    import java.io.Serializable;
    import java.lang.Exception;
    import oracle.apps.fnd.common.VersionInfo;
    import oracle.apps.fnd.framework.OAApplicationModule;
    import oracle.apps.fnd.framework.webui.OAControllerImpl;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import org.w3c.dom.Element;
    import xxcu.oracle.apps.ar.customer.ws.LindorffWS;
    * Controller for ...
    public class CustomerCO extends OAControllerImpl implements Serializable
    public static final String RCS_ID="$Header$";
    public static final boolean RCS_ID_RECORDED =
    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
    * Layout and page setup logic for a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    * Procedure to handle form submissions for form elements in
    * a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    * 2009.07.09, Roy Feirud, lagt til for å utføre spørring
    if (pageContext.getParameter("Search") != null)
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    //Setter søkekriteriene til LindorffWS
    String Name = pageContext.getParameter("SearchName");
    String Address = pageContext.getParameter("SearchAddress");
    String Zip = pageContext.getParameter("SearchZipCode");
    String City = pageContext.getParameter("SearchCity");
    String Born = pageContext.getParameter("SearchBorn");
    String Phone = pageContext.getParameter("SearchPhoneNo");
    Serializable[] param = { Name, Address, Zip, City, Born, Phone };
    //Bygger søkestrengen
    String SearchString = (String)am.invokeMethod("initBuildString", param );
    //Initialiserer LindorffWS
    LindorffWS WsConnection = new LindorffWS();
    try
    //Kaller Web Sevice fra Lindorff
    Element wsXml = (Element)WsConnection.XmlFulltextOperator(SearchString);
    String Status = (String)am.invokeMethod("initSaveXml", wsXml);
    catch(Exception WsExp)
    // WsConnection = new LindorffWS();
    System.out.println("Kall til LindorffWS feilet!");
    am.invokeMethod("initQueryCustomer");
    CustomerAMImpl.java:
    package xxcu.oracle.apps.ar.customer.server;
    import java.io.Serializable;
    import java.sql.CallableStatement;
    import java.sql.SQLException;
    import java.sql.Types;
    import oracle.apps.fnd.common.MessageToken;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
    import oracle.apps.fnd.framework.server.OADBTransaction;
    import oracle.apps.fnd.framework.server.OAExceptionUtils;
    import org.w3c.dom.Element;
    // --- File generated by Oracle Business Components for Java.
    public class CustomerAMImpl extends OAApplicationModuleImpl implements Serializable
    * This is the default constructor (do not remove)
    public CustomerAMImpl()
    * Sample main for debugging Business Components code using the tester.
    public static void main(String[] args)
    launchTester("xxcu.oracle.apps.ar.customer.server", "CustomerAMLocal");
    * Container's getter for CustomerVO1
    public CustomerVOImpl getCustomerVO1()
    return (CustomerVOImpl)findViewObject("CustomerVO1");
    * 2009.07.09, Roy Feirud, Lagt til for å utføre spørring.
    public void initQueryCustomer()
    CustomerVOImpl vo = getCustomerVO1();
    if (vo!=null)
    vo.initQuery();
    * 2009.08.31, Roy Feirud, Lagt til for å bygge opp input til WebService hos Lindorff.
    public String initBuildString(String Name
    ,String Address
    ,String Zip
    ,String City
    ,String Born
    ,String Phone)
    String ws_string = null;
    CallableStatement cs = null;
    try
    String sql= "BEGIN ISS_WS_LINDORFF_PKG.BUILD_STRING (?,?,?,?,?,?,?); END;";
    OADBTransaction txn = getOADBTransaction();
    cs = txn.createCallableStatement(sql,1);
    cs.setString(1,Name);
    cs.setString(2,Address);
    cs.setString(3,Zip);
    cs.setString(4,City);
    cs.setString(5,Born);
    cs.setString(6,Phone);
    cs.registerOutParameter(7,Types.VARCHAR);
    cs.execute();
    OAExceptionUtils.checkErrors (txn);
    ws_string = cs.getString(7);
    cs.close();
    catch (SQLException sqle)
    String Prosedyre = "ISS_WS_LINDORFF_PKG.BUILD_STRING";
    String Errmsg = sqle.toString();
    MessageToken[] tokens = {new MessageToken("PROSEDYRE", Prosedyre), new MessageToken("ERRMSG", Errmsg)};
    throw new OAException("ISS", "ISS_PLSQL_ERROR",tokens,OAException.ERROR, null);
    return ws_string;
    public String initSaveXml(Element WsXml)
    String Status = "Error";
    CallableStatement cs = null;
    try
    String sql= "BEGIN ISS_XML2TABLE_PKG.ISS_AR_CUSTOMERS_TMP (?,?); END;";
    OADBTransaction txn = getOADBTransaction();
    cs = txn.createCallableStatement(sql,1);
    cs.setObject(1,WsXml);
    cs.registerOutParameter(2,Types.VARCHAR);
    cs.execute();
    OAExceptionUtils.checkErrors (txn);
    Status = cs.getString(2);
    cs.close();
    catch (SQLException sqle)
    String Prosedyre = "ISS_XML2TABLE_PKG.ISS_AR_CUSTOMERS_TMP";
    String Errmsg = sqle.toString();
    MessageToken[] tokens = {new MessageToken("PROSEDYRE", Prosedyre), new MessageToken("ERRMSG", Errmsg)};
    throw new OAException("ISS", "ISS_PLSQL_ERROR",tokens,OAException.ERROR, null);
    return Status;
    LindorffWS.java:
    package xxcu.oracle.apps.ar.customer.ws;
    import oracle.soap.transport.http.OracleSOAPHTTPConnection;
    //import org.apache.soap.encoding.soapenc.BeanSerializer;
    import org.apache.soap.encoding.SOAPMappingRegistry;
    //import org.apache.soap.util.xml.QName;
    import java.util.Vector;
    import org.w3c.dom.Element;
    import java.net.URL;
    import org.apache.soap.Body;
    import org.apache.soap.Envelope;
    import org.apache.soap.messaging.Message;
    import oracle.jdeveloper.webservices.runtime.WrappedDocLiteralStub;
    * Generated by the Oracle9i JDeveloper Web Services Stub/Skeleton Generator.
    * Date Created: Fri Jul 10 10:37:21 CEST 2009
    * WSDL URL: http://services.lindorffmatch.com/Search/Search.asmx?WSDL
    public class LindorffWS extends WrappedDocLiteralStub
    public LindorffWS()
    m_httpConnection = new OracleSOAPHTTPConnection();
    public String endpoint = "http://services.lindorffmatch.com/Search/Search.asmx";
    private OracleSOAPHTTPConnection m_httpConnection = null;
    private SOAPMappingRegistry m_smr = null;
    public Element XmlFulltextOperator(String xmlString) throws Exception
    URL endpointURL = new URL(endpoint);
    Envelope requestEnv = new Envelope();
    Body requestBody = new Body();
    Vector requestBodyEntries = new Vector();
    String wrappingName = "XmlFulltextOperator";
    String targetNamespace = "http://services.lindorffmatch.com/search";
    Vector requestData = new Vector();
    requestData.add(new Object[] {"xmlString", xmlString});
    requestBodyEntries.addElement(toElement(wrappingName, targetNamespace, requestData));
    requestBody.setBodyEntries(requestBodyEntries);
    requestEnv.setBody(requestBody);
    Message msg = new Message();
    msg.setSOAPTransport(m_httpConnection);
    msg.send(endpointURL, "http://services.lindorffmatch.com/search/XmlFulltextOperator", requestEnv);
    Envelope responseEnv = msg.receiveEnvelope();
    Body responseBody = responseEnv.getBody();
    Vector responseData = responseBody.getBodyEntries();
    return (Element)fromElement((Element)responseData.elementAt(0), org.w3c.dom.Element.class);
    _______________________________________________________________________________________________________________________________

    Hi,
    wrong forum. If this is a problem related to the use of OA framework, please use the OA framework forum here on OTN
    Frank

  • Trim() not found in java.lang.String !

    Hi, I am using weblogic 6 eval version on NT. I am getting this error. ***************************************************************************
    The WebLogic Server did not start up properly. Exception raised: weblogic.management.configuration.ConfigurationException:
    BeanShell Interpreter threw exception while evaluating ((value != null) && (value.trim().length()
    0) ) on value mydomain, getLegalCheck() for attribute Name of MBean "mydomain:Name=mydomain,Type=Domain", bsh.EvalError: Line 1 : sourced file: <inline eval> bsh.EvalError:
    Error in method invocation: No args method trim() not found in cl ass'java.lang.String'
    : value .trim ( ) : at weblogic.management.internal.xml.ConfigurationParser.parse(Configurat
    ionParser.java:120) at weblogic.management.internal.xml.XmlFileRepository.loadDomain(XmlFile
    Repository.java:261) at weblogic.management.internal.xml.XmlFileRepository.loadDomain(XmlFile
    Repository.java:223) at java.lang.reflect.Method.invoke(Native Method) at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:636) at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    .java:621) at weblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:359) at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55) at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15 23)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468) at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy1.loadDomain(Unknown Source) at weblogic.management.AdminServer.configureFromRepository(AdminServer.j
    ava:188) at weblogic.management.AdminServer.configure(AdminServer.java:173) at weblogic.management.Admin.initialize(Admin.java:239)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:362) at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:202)
    at weblogic.Server.main(Server.java:35) Reason: Fatal initialization exception ***************************************************************************
    Can someone help? Thanks.

    prolly stating the obvious here, but have you also tried with it configured
    to use neither jdk? (to make sure that it fails - if it still runs you
    aren't using the jdk you expected)
    "safdar " <[email protected]> escribió en el mensaje
    news:[email protected]...
    >
    Actually, I am using jkd1.4. I even tried jkd1.3 that came
    with the server. I get the same error under both versions.
    "Andrew Cooke" <[email protected]> wrote:
    just guessing, it looks like you might be using an old version of java
    (or
    of the class libraries), rather than the version that comes with weblogic
    server.
    andrew
    "safdar " <[email protected]> escribió en el mensaje
    news:[email protected]...
    Hi, I am using weblogic 6 eval version on NT. I am getting this error.
    The WebLogic Server did not start up properly. Exception raised:weblogic.management.configuration.ConfigurationException:
    BeanShell Interpreter threw exception while evaluating ((value != null)&&
    (value.trim().length()
    0) ) on value mydomain, getLegalCheck() for attribute Name of MBean"mydomain:Name=
    mydomain,Type=Domain", bsh.EvalError: Line 1 : sourced file: <inline
    eval>
    bsh.EvalError:
    Error in method invocation: No args method trim() not found in class'java.lang.String'
    : value .trim ( ) : atweblogic.management.internal.xml.ConfigurationParser.parse(Configurat
    ionParser.java:120) atweblogic.management.internal.xml.XmlFileRepository.loadDomain(XmlFile
    Repository.java:261) atweblogic.management.internal.xml.XmlFileRepository.loadDomain(XmlFile
    Repository.java:223) at java.lang.reflect.Method.invoke(Native Method)at
    weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMB
    eanImpl.java:636) atweblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl
    java:621) atweblogic.management.internal.ConfigurationMBeanImpl.invoke(Configurat
    ionMBeanImpl.java:359) atcom.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    55) atcom.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15 23)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)at
    weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy1.loadDomain(Unknown Source) atweblogic.management.AdminServer.configureFromRepository(AdminServer.j
    ava:188) atweblogic.management.AdminServer.configure(AdminServer.java:173) at
    weblogic.management.Admin.initialize(Admin.java:239)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:362) atweblogic.t3.srvr.T3Srvr.run(T3Srvr.java:202)
    at weblogic.Server.main(Server.java:35) Reason: Fatal initializationexception***************************************************************************
    Can someone help? Thanks.

  • Error:  java/lang/String  & parsefloat not a method in class Float (j0235)

    Hi,
    I don't know why i amgetting this error which says: 'unable to locate system class: java/lang/String.
    I have compiled and executed the reader method separately on a command prompt and it is working, but when i do it in microsoft visual j++, i am getting this run time error.
    I also have rt.jar in the classpath.
    If i don't have this rt.jar in my classpath, it is giving me a compilation error: parsefloat is not a method in class Float (j0235).
    somebody please help.
    Jagadish.
    // an agent is floating randomly.
    import java.util.*;
    import vrml.*;
    import vrml.node.*;
    import vrml.field.*;
    import java.io.*;
    public class FloatingAgent extends Script{
    SFVec3f setAgentPosition;
    SFRotation setAgentRosition;
    static int count=0;
    float agentPosition[] = new float[3];
    float agentRosition[] = new float[4];
    float rotangle = 0.0f;
    float aRad= (float) (Math.PI/180);
    public void initialize(){
    setAgentPosition =
    (SFVec3f)getEventOut("setAgentPosition");
    setAgentRosition =
    (SFRotation)getEventOut("setAgentRosition");
    // initialize the agent position.
    agentPosition[0] = 0.0f;
    agentPosition[1] = 0.0f;
    agentPosition[2] = 0.0f;
    agentRosition[0] = 0.0f;
    agentRosition[1] = 0.0f;
    agentRosition[2] = 1.0f;
    agentRosition[3] = 0.0f;
    public void processEvent(Event e){
    if(e.getName().equals("interval") == true){
    moveAgent();
    void moveAgent()
    agentPosition = reader();
    rotangle += 2.0f;
    agentRosition[3] = rotangle * aRad;
    // move the agent to the new position.
    setAgentPosition.setValue(agentPosition);
    setAgentRosition.setValue(agentRosition);
    }//move agent
    static float[] reader()
    float p1[] = new float[3];
    try{
    FileReader fr = new FileReader("data.txt");
    BufferedReader br = new BufferedReader(fr);
    String s;
    int count1=0;
    count++;
    try{
    while((s=br.readLine())!=null)
    count1++;
    StringTokenizer st = new StringTokenizer(s);
    if(count1==count)
    int i=0;
    while(st.hasMoreTokens())
    p1[i++]=Float.parseFloat(st.nextToken());
    }//if
    }//end of stringTokenizer while.
    fr.close();
    catch(IOException f)
    System.out.println("file cannot be opened");
    }//try
    catch(FileNotFoundException e)
    System.out.println("file doesn't exist");
    } //try
    return p1;
    }//reader

    still using Visual J++ ???

  • 2 errors: static context & java.lang.String

    I get the following 2 errors when I try and compile my code. What do I need to do in order to fix this problem?
    Any help appreciated.
    C:\>javac DraftD.java
    DraftD.java:54: non-static variable MAXIMUM cannot be referenced from a static context
    if(temp <= MAXIMUM)
    ^
    DraftD.java:54: operator <= cannot be applied to java.lang.String,int
    if(temp <= MAXIMUM)
    ^
    2 errors
    import java.io.*;
    import java.util.*;
    public class DraftD
    final int MAXIMUM = 20;
    public static void main(String[] args) throws IOException
    try
    Runtime program = Runtime.getRuntime();
    Process proc = program.exec("cmd.exe /c C:/ntpq.exe -p >C:/answer.txt");
    try{
    proc.waitFor();
    catch (InterruptedException e){}
    catch(IOException e1)
    int i = 0;
    BufferedReader br = new BufferedReader(new FileReader("C:/answer.txt"));
    String line = "";
    while ((line = br.readLine()) != null)
    i++;
    if(i==3) break;
    br.close();
    if(i==3)
    StringTokenizer st = new StringTokenizer(line," ");
         int k=1;
    while(st.hasMoreTokens())
         String temp = st.nextToken();
    if(k==2){
              String secondToken = temp;
    if(temp <= MAXIMUM)
              {System.out.println("less than Max");}
         k++;
    else System.out.println("less than 3 lines in file");
    System.exit(0);
    }

    You should use Integer.parseInt(temp); to convert temp to an int
    Because MAXIMUM is not static, every DraftD object will have one, that's the way properties work.
    main() however is static, and so there is only one between all the DraftD objects.
    It is a bit harder to explain with main(), but suppose we did this:public class ABC
      public int x;
      public static int getX()
        return x;
    ABC a = new ABC();
    ABC b = new ABC();
    a.x = 1;
    b.x = 2;
    int result = ABC.getX();should result be 1 or 2? it doesn't know which x to get, so the compiler complains.
    if MAXIMUM is a constant, you should make it public static final

  • Re: cannot be applied to (double,java.lang.String)

    It's telling you what the problem is -- you're trying to pass a String in where a double is required. Java is a strongly typed language, which means that you can't expect types to change automatically into other types as needed.
    You could, I suppose, parse the string, assuming that it holds a representation of a double. But if you look at the method in question, you'll see that it doesn't even use its second (double) argument.
    So you should ask yourself:
    1) should that method really take two arguments?
    2) what is the second argument for, if I did use it?
    3) what is the best type to represent the second argument?
    (hint: with a name like "customerType", then an enum seems likely)
    [add]
    Too slow again.
    Though I'll also add: please wrap any code you post in [code][/code] tags. It makes your code much easier to read.
    Message was edited by:
    paulcw

    >  String n ;
    n = JOptionPane.showInputDialog(null, "Enter Month No.:");
    pow(double,double) in java.lang.Math cannot be
    applied to (double,java.lang.String)Read the error diagnostic carefully: the compiler found a pow() method
    in the Math class, but it takes two doubles as its arguments. You,
    however, supplied a double and a String as the parameter types.
    The method found by the compiler cannot be applied to your parameters.
    hint: you have to convert that String to a double,
    kind regards,
    Jos

Maybe you are looking for

  • Calendar List View in IOS 7.1. Where is it?

    Where the heck did the list view go in the New? IOS 7.1 Why was this HUGE and Important feature deleted? If not deleted the the heck is it? Why did Apple bury/delete this important feature?????? Not good

  • How to set underlined text in a label

    i want to set text which is underlimned but i am not being able to do that can anyone help thanx

  • Problem exporting slideshow

    I hope someone can help me, I am new to MAC. I have just created my first slideshow in iPhoto (88 slides-3 songs). When I preview the slideshow in iPhotos the slides and photos are in perfect sync. I then export the slideshow to iDVD as I have read i

  • Function Module "where used list"

    I'm looking for a function module which does the same as the where used list: i want to have all tables conataining a special field e.g. mandt. Is there such a FM available?

  • Adobe Installer error code 205

    Hello Adobe community, am currently stuck and need a solution. I've downloading adobe creative cloud set-up but run into a problem when I run the Adobe installer. I get an error message with the following, "We've encountered the following issues: The