Getting null for getRealPath.

Hi All,
Having 'resources' folder under WEB-INF folder, whiile trying to get RealPath it is returning 'null' value in basePath variable.
       HttpSession session = (HttpSession) FacesContext.getCurrentInstance().
                                                                getExternalContext().getSession(true);
        String basePath = session.getServletContext().getRealPath("/WEB-INF/resources");
  Please let me know how to get real path in JSF.
Thanks,
Sharath.

It's an appserver thing. It will return null when the WAR is not extracted and also in some Weblogic configs/environments it will always return null regardless of WAR setup. This is not related to JSF.
Not related to your actual problem, but just a cosmetic hint, the getSession(true) is superfluous with a hardcoded boolean "true", just use getSession(). Further on, instead of HttpSession#getServletContext(), you can also get the ServletContext directly by ExternalContext#getContext().

Similar Messages

  • Getting NULL for ctx.lookup

    Hi,
    I was creating a HTTP destination but getting below exception.
    OUTPUT:
    Start line
    ctx : javax.naming.InitialContext@f32b694
    Completed Step 1
    tc~sec~destinations~service
    Completed Step 2
    Inside if of dstService
    com.sap.engine.services.jndi.persistent.exceptions.NamingException: <--Localization failed: ResourceBundle='com.sap.engine.services.jndi.persistent.JNDIResourceBundle', ID='Destination Service not available', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key Destination Service not available
      at Client.main(Client.java:46)
    below is the code. I think the code is not getting destination service object from server. What is the step to add "destinationservice" in SAP NW 731 portal?
    import java.rmi.RemoteException;
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import com.sap.engine.services.jndi.persistent.exceptions.NamingException;
    import com.sap.security.core.server.destinations.api.DestinationException;
    import com.sap.security.core.server.destinations.api.DestinationService;
    import com.sap.security.core.server.destinations.api.HTTPDestination;
    public class Client {
      * @param args
      public static void main(String[] args) {
      // TODO Auto-generated method stub
      Hashtable<String, String>  env = new Hashtable<String, String>();
         env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
         env.put(Context.PROVIDER_URL, "<HostName>:<P4_port>");
         env.put(Context.SECURITY_PRINCIPAL, "<user>");
         env.put(Context.SECURITY_CREDENTIALS, "<password>");
      try{
      System.out.println("Start line");
      Context ctx = new InitialContext(env);
      System.out.println("ctx : " +ctx.toString());
      System.out.println("Completed Step 1");
      System.out.println(DestinationService.JNDI_KEY);
         DestinationService dstService = (DestinationService)ctx.lookup(DestinationService.JNDI_KEY); //getting null at this line
         System.out.println("Completed Step 2");
         if (dstService == null){
          System.out.println("Inside if of dstService");
          ctx.close();
             throw new NamingException("Destination Service not available");
         //Note: this only created the destination
         //it needs to be stored using dstService.storeDestination
         System.out.println("Completed Step 4");
         HTTPDestination destination = (HTTPDestination)
         dstService.createDestination("HTTP");
         destination.setUrl("http://<host>:<HTTP_port>");
         destination.setName("UMEConnection");
         destination.setUsernamePassword("<userName>", "<password>");
         dstService.storeDestination("HTTP", destination);
      }catch(DestinationException | RemoteException | javax.naming.NamingException e){
      e.printStackTrace();
    The ctx is coming as null.

    Hi Hamendra,
    Even after hard coding DestinationService.JNDI_KEY to tc~sec~destinations~service in the code, I am getting dstService = null.
    Is there anything else I need to change in SAP portal NWA?
    Is there any way to check the destination services that are available in SAP Portal?
    Thanks
    Alingan Patra

  • Get null for OTNDeptEmp  DEPT/EMP Live Web Service

    Using Oracle 9i JDeveloper Vers. 9.0.2.829. Has anyone successfully run this live web service with a proxy?
    I made the changes to OTN.DeptEmpStub for proxy but when I run Class1.java the returnVal for getDeptNoArray is null
    so I assume I'm not getting out our firewall or back through? Is there any way to test to see how far I'm getting or any clues as to
    what is wrong??? I eventually get this error --- java.lang.NullPointerException
         void mypackage1.Class1.main(java.lang.String[])

    Thanks Mike - this got me further but now I get?? Any clues or should I email [email protected]?
    D:\jdeveloper\jdk\bin\javaw.exe -ojvm -classpath D:\jdeveloper\jdev\mywork\Workspace1\Project1\classes;D:\jdeveloper\jdev\lib\jdev-rt.jar;D:\jdeveloper\soap\lib\soap.jar;D:\jdeveloper\lib\xmlparserv2.jar;D:\jdeveloper\jlib\javax-ssl-1_2.jar;D:\jdeveloper\jlib\jssl-1_2.jar;D:\jdeveloper\jdk\jre\lib\ext\activation.jar;D:\jdeveloper\jdk\jre\lib\ext\mail.jar;D:\jdeveloper\j2ee\home\lib\http_client.jar;D:\jdeveloper\lib\xmlparserv2.jar;D:\jdeveloper\lib\xmlcomp.jar -Dhttp.proxyHost=proxy.scott.af.mil -Dhttp.proxyPort=375 mypackage1.Class1
    Example 1 - Department numbers
    Got this far
    Got into getDeptNoArray
    after setSoapTransport
    after setTargetObjectURI
    [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type &quot;text/html; charset=iso-8859-1&quot;, must be: &quot;text/xml&quot;. Response was:
    &lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML 2.0//EN&quot;&gt;
    &lt;HTML&gt;&lt;HEAD&gt;
    &lt;TITLE&gt;500 Internal Server Error&lt;/TITLE&gt;
    &lt;/HEAD&gt;&lt;BODY&gt;
    &lt;H1&gt;Internal Server Error&lt;/H1&gt;
    The server encountered an internal error or
    misconfiguration and was unable to complete
    your request.&lt;P&gt;
    Please contact the server administrator,
    [email protected] and inform them of the time the error occurred,
    and anything you might have done that may have
    caused the error.&lt;P&gt;
    More information about this error may be available
    in the server error log.&lt;P&gt;
    &lt;HR&gt;
    &lt;ADDRESS&gt;Oracle HTTP Server/1.3.22 Server at otn.oracle.com Port 7790&lt;/ADDRESS&gt;
    &lt;/BODY&gt;&lt;/HTML&gt;
         java.lang.String org.apache.soap.rpc.Call.getEnvelopeString(org.apache.soap.transport.SOAPTransport)
         org.apache.soap.rpc.Response org.apache.soap.rpc.Call.invoke(java.net.URL, java.lang.String)
         java.lang.String[] mypackage1.OTNDeptEmpStub.getDeptNoArray()
         void mypackage1.Class1.main(java.lang.String[])
    Process exited with exit code 0.

  • How can I get null values for the later weeks

    Hi All,
    When I execute this code I get the records till current week.
    How can I display the output so that I get null values for the later weeks. (with the help of v_numOfWeeks variable in the code)
    Thanks,
    Vikram
    DECLARE
       v_query VARCHAR2(4000);
       TYPE ref_cursor IS REF CURSOR;
       v_refcur ref_cursor;
       v_sum NUMBER;
       v_id NUMBER;
       v_name VARCHAR2(1000);
       v_weeknum NUMBER;
       v_pernum NUMBER;
       v_numOfWeeks NUMBER := 5;
    BEGIN
    v_query := ' SELECT SUM(product_bkg), postn_id, postn_tbl.postn_name, b.week_num, b.period_num
                              FROM ops_cv_extract b, (SELECT row_id, desc_text postn_name
                          FROM s_postn) postn_tbl
                          WHERE lvl_6_id = 5767
                          AND fiscal_year = 2008
                          AND b.week_num < 4
                          AND b.period_num = 3
                          AND b.postn_id = TO_NUMBER(postn_tbl.row_id)
                          GROUP BY postn_id, postn_tbl.postn_name, b.week_num, b.period_num
                          ORDER BY  postn_tbl.postn_name, b.week_num';
    OPEN v_refcur FOR v_query;
    LOOP
       FETCH v_refcur INTO v_sum, v_id, v_name, v_weeknum, v_pernum;
       EXIT WHEN v_refcur%notfound;
       dbms_output.put_line('P'|| v_pernum||'W'|| v_weeknum||' '||v_name||' '||v_sum);
    END LOOP;
    END;
    This is the output when I execute this code.
    P3W1 COMM CNTRL ISAM 213 26961.61
    P3W2 COMM CNTRL ISAM 213 12870.4
    P3W3 COMM CNTRL ISAM 213 245.88
    P3W1 COMM CNTRL ISAM 273 72831.2
    P3W2 COMM CNTRL ISAM 273 8739.38
    P3W3 COMM CNTRL ISAM 273 3764.92
    P3W1 COMM CNTRL TAM 213 49844
    P3W2 COMM CNTRL TAM 213 20515.17
    P3W3 COMM CNTRL TAM 213 16167.46
    P3W2 COMM CNTRL TAM 216 12561.4
    P3W3 COMM CNTRL TAM 216 2027.1
    P3W1 COMM CNTRL TAM 273 -3336.71
    P3W2 COMM CNTRL TAM 273 -1376.68
    P3W3 COMM CNTRL TAM 273 19707.42
    P3W1 Damon Walters -609.07
    P3W2 Damon Walters 30030.24
    P3W3 Damon Walters 37475.1
    This is the output I'd like to get
    P3W1 COMM CNTRL ISAM 213 26961.61
    P3W2 COMM CNTRL ISAM 213 12870.4
    P3W3 COMM CNTRL ISAM 213 245.88
    P3W4 COMM CNTRL ISAM 213
    P3W5 COMM CNTRL ISAM 213
    P3W1 COMM CNTRL ISAM 273 72831.2
    P3W2 COMM CNTRL ISAM 273 8739.38
    P3W3 COMM CNTRL ISAM 273 3764.92
    P3W4 COMM CNTRL ISAM 273
    P3W5 COMM CNTRL ISAM 273
    P3W1 COMM CNTRL TAM 213 49844
    P3W2 COMM CNTRL TAM 213 20515.17
    P3W3 COMM CNTRL TAM 213 16167.46
    P3W4 COMM CNTRL TAM 213
    P3W5 COMM CNTRL TAM 213
    P3W1 COMM CNTRL TAM 273 -3336.71
    P3W2 COMM CNTRL TAM 273 -1376.68
    P3W3 COMM CNTRL TAM 273 19707.42
    P3W4 COMM CNTRL TAM 273
    P3W5 COMM CNTRL TAM 273
    P3W1 Damon Walters -609.07
    P3W2 Damon Walters 30030.24
    P3W3 Damon Walters 37475.1
    P3W4 Damon Walters
    P3W5 Damon Walters Edited by: polasa on Oct 28, 2008 6:42 PM

    Sure, in a Single SQL ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>
    satyaki>-- Start Of Test Data --
    satyaki>with week_tab
      2  as
      3    (
      4      select 1 period_num, 1 week_num, 10 bkg1 from dual
      5      union all
      6      select 1, 2, 40 from dual
      7      union all
      8      select 1, 3, 30 from dual
      9      union all
    10      select 1, 2, 20 from dual
    11      union all
    12      select 1, 1, 10 from dual
    13      union all
    14      select 1, 1, 20 from dual
    15      union all
    16      select 1, 3, 10 from dual
    17      union all
    18      select 2, 1, 15 from dual
    19      union all
    20      select 2, 2, 20 from dual
    21      union all
    22      select 2, 3, 10 from dual
    23      union all
    24      select 2, 1, 15 from dual
    25      union all
    26      select 2, 2, 30 from dual
    27      union all
    28      select 2, 3, 20 from dual
    29    )
    30  -- End Of Test Data --
    31  select period_num,
    32         week_num,
    33         (
    34            select sum(week_tab.bkg1)
    35            from week_tab
    36            where period_num = m.period_num
    37            and   week_num   = m.week_num
    38            group by week_num, period_num
    39         ) sum_bkg1
    40  from (
    41        select dum.week_num,
    42              wk.period_num
    43        from (
    44                select 1 week_num from dual
    45                union all
    46                select 2 from dual
    47                union all
    48                select 3 from dual
    49                union all
    50                select 4 from dual
    51                union all
    52                select 5 from dual
    53              ) dum ,
    54              (
    55                select distinct period_num
    56                from week_tab
    57          ) wk
    58      ) m;
    PERIOD_NUM   WEEK_NUM   SUM_BKG1
             1          1         40
             1          2         60
             1          3         40
             1          4
             1          5
             2          1         30
             2          2         50
             2          3         30
             2          4
             2          5
    10 rows selected.
    Elapsed: 00:00:00.48
    satyaki>Regards.
    Satyaki De.

  • Getting null value for inputfile component in the popup

    Hi,
    My requirement is when i select the selectBooleanCheckBox a popup has to be rendered and with in that popup i have to display the inputfile component when i browse it should read the appropriate file.
    But i am getting null from the input file component.
    I written the code like this:-
    1.First i have written a value change listener for the selectBoolenCheckBox.
    2.I am rendering the popup from the valueChageEvent.
    3.And i written the dialogListener for the Dialog in the popup.
    and the code for the Dilog listener is:--
    public void readingInputFile(DialogEvent dialogEvent) {
    inputFile1.getValue();
    //it is giving null value.
    thanks in advance.
    From
    Srikanth.V

    thanks for giving suggestion.
    but i am not able to understand what meant by multipart in dialog page.
    Actually,The code i written was:--
    1. for selectBooleanCheckBox i written value chage listener
    onChangeValue(ValueChageEvent valueChageEvent){
    // in this i call the method to raise popup;
    risePopUp();
    2.The popup structure has follows:-
    af:form --> af:popup ---> af:dialog --->af:inputfile
    for this dialog i have written dilogListener:
    getInputFile(DialogEvent dialogEvent){
    //giving null for the inputFile,getValue();
    for this dialog i don't have any multipart property
    From,

  • Why am I getting the error "Coercion Failed: Input cannot be null for this coercion"?

    I created a OOTB team site, with a OOTB document library and an OOTB "Approval - SharePoint 2010" workflow.  Under the workflow's start options I have "Allow this workflow to be manually..." checked.  On the next workflow setup page, I put
    myself in the Assign To field and put "test" in the Request field.  I left everything else blank. 
    Then, I setup a retention stage in the Information Management Policy settings for the library.  The event is Modified + 1 days, action is Start a workflow and I selected the workflow described above.  I set the Recurrence for 1 days.
    If I execute the workflow manually, it executes without error. 
    When the IMP executes the workflow, the status indicated in the column added to the library is "Canceled".  Clicking on the Canceled link opens the Workflow Information.  In the Workflow History section the Event Type is Error, User ID is System
    Account and Description is "Coercion Failed: Input cannot be null for this coercion". 
    Research shows that this error can be invoked when creating custom workflows that contain empty input fields when executed.  I would think that if there were required input fields in the workflow
    configuration, that the workflow would error when manually executed. 
    Any help is appreciated.  Thank you.
    Matt H.

    I had found that article previously but it doesn't seem to apply since this is OOTB and not a workflow created in SD.  I would expect that MS would have created the workflow in such a manner that it would work with IMP.  Besides, I don't think
    it's possible to edit the default Approvers workflow.  Also, I'm sure I'm not the first one out there to use the Approvers workflow with IMP.  If it was broken OOTB, someone else would have discovered it.  My guess is that there is something
    not configured correctly on the server, but I don't know how to start to diagnose it based on this error message.Matt H.

  • While running a report through workspace getting "Null" error

    While running a report through workspace i am getting "Null" error.i have checekd the db connection and also access to hfm.
    Thanks

    Hi Raj,
    There are a few OSS Notes for your issue.
    If your Query has hierarchy in it then check 734184
    If your query is based on Infoset then check Note 784502 and 701941.
    Also check 668921.
    Bye
    Dinesh

  • Reading and writing to file , getting null when i try to  read file content

    i start by apologizing incase i have posted this question in the wrong forum
    i am trying to iterate through a directory tree and pick all the subdirectories and put them in an arraylist . on the other hand , i am picking all the files and putting them in a different arraylist . After that i iterate through the arraylist , pick a folder , create a file in it search for all the files of the same type in its subfolders and write them to the newly created file
    The problem i am running into is i i can't read the files and hence i can't write to the file .
    My directory tree is in the format
    c:\KPCData\\01\01\01\01\01\ file1_type1
    c:\KPCData\\01\01\01\01\02\ file2_type1
    where one one of the types is "covers" . i know this could be asking too much but i am at my tethers end , could someone please have a look at the code and tell me where i might be going wrong . you could zero in on the part where i have ************ before the a line of code thank you package directories;
    import java.io.*;
    import java.util.*;
    public class Directories {
    private static  ArrayList direcs= new ArrayList();
    private static  ArrayList census= new ArrayList();
    private static ArrayList vagrant= new ArrayList();
    private static ArrayList hotel= new ArrayList();
    private static ArrayList emigrant= new ArrayList();
    private static ArrayList traveller= new ArrayList();
    private static ArrayList longform= new ArrayList();
    private static ArrayList cover= new ArrayList();
    private static String parentPath = null;
    private static File mycover = null;
    private static File mytravel = null;
    private static File myemigrant = null;
    private static File mylong= null;
    private static File myinstitution = null;
    private static File myvagrant = null;
    private static BufferedReader in;
    private static BufferedWriter out;
    private static String read,toread;
    //function for listing the folder contents
    class compareDirs implements Comparator
    public int compare(Object one, Object two)
         int val=0;
         File file1 = (File)one;
         File file2= (File)two;
         String name1 = file1.toString();
         String name2= file2.toString();
         if (name1.length()==name2.length())
         val= name1.compareTo(name2);
         else
              if( name1.length()>name2.length())
                   val=-1;
              if (name1.length()<name2.length())
                   val=1;
         return val;
    private  ArrayList recurs(File dir,File file) throws IOException
         File []files=dir.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   recurs(files[index],file);          
              }//if
              else
                  census.add(files[index]);     
         }//for index
         return census;
    } //recurs
    //function for determining the number and paths of the folders
    private ArrayList numDirs(File dirs)
         File []files=dirs.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   if (direcs.contains(files[index])==false)
                   direcs.add(files[index]);
                   numDirs(files[index]);     
              }//if
         }//for index
         return direcs;
    public static void main(String[]args) throws IOException
              File myfile = new File("C:\\KPCData");
         File myfile2= new  File("C:\\KPCData\test.txt");
         Directories dir = new Directories();
         if (myfile.isDirectory())
         ArrayList myList=dir.recurs(myfile,myfile2);
         ArrayList mydir1 = dir.numDirs(myfile);
        ArrayList mydirs = new ArrayList();
        mydirs.add(mydir1.get(0));
         for (int x=0;x<mydir1.size();x++)
         {  int count=0;
              for (int y=0;y<mydirs.size();y++)
                   if (x==y)
                        count++;
              if (count<1)
                   mydirs.add(mydir1.get(x));
         Collections.sort( mydirs,dir.new compareDirs() );     
            for(int index1 =0 ;index1<mydirs.size();index1++)//print out directories
              File mydir=(File)mydirs.get(index1);
              File directory= (File)mydirs.get(index1);
              if(!mydir.getPath().contains("00"))//// if not leave node  create files for each file type
                   String name1 =mydir.getPath();
                   ArrayList ray=new ArrayList();
                   String name="K";
                 for (int index=0;index<name1.length();index++ )
                          if (name1.charAt(index)!='\\'&&name1.charAt(index)!='C'&&name1.charAt(index)!=':'&&name1.charAt(index)!='K'&&name1.charAt(index)!='P'&&name1.charAt(index)!='D'&&name1.charAt(index)!='a'&&name1.charAt(index)!='t')
                       name =name+(String.valueOf(name1.charAt(index)));
              // create a string
                  name= name.substring(1);
                   String trial = name+"_cover.dat";
                   mycover = new File ( mydir,trial);
                     if (mycover.exists()) {
                          mycover.delete();
                          mycover.createNewFile();
                      } else {
                           mycover.createNewFile();
                     String addit = mydir.getParent().toString();
                    mylong = new File (addit+"\\_long.dat");
                    if (mylong .exists()) {
                          mylong.delete();
                          //mylong.createNewFile();
                      } else {
                            //mylong.createNewFile();
                              myemigrant = new File (mydir.getParent()+"\\_emigrant.dat");
                              if (myemigrant.exists()) {
                                   myemigrant.delete();
                                  // myemigrant.canWrite();
                                } else {
                                     //  myemigrant.canWrite();
                   mytravel= new File (mydir.getParent().toString()+"\\_traveller.dat");
                    if (mytravel.exists()) {
                        mytravel.delete();
                       // mytravel.createNewFile();
                      } else {
                           //mytravel.createNewFile();
                    myinstitution = new File (mydir.getParent().toString()+"\\_institution.dat");
                    if (myinstitution.exists()) {
                          myinstitution.delete() ;
                         // myinstitution.createNewFile();
                      } else {
                           //myinstitution.createNewFile();
                    myvagrant = new File (mydir.getParent().toString()+"\\_vagrant.dat");
                    if (myvagrant .exists()) {
                         myvagrant.delete();
                        // myvagrant.createNewFile();
                      } else {
                           //myvagrant.createNewFile();
         //}//initial
              for( int index2 =0;index2<myList.size();index2++)//loop the second one for individual files
                   File file= (File)myList.get(index2);
                   if (file.getParent().contains("00"))//leave node
                        parentPath =file.getParent().substring(0, file.getParent().length()-4);
                   else
                        parentPath =file.getParent().substring(0, file.getParent().length()-3);
                   if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new  FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
    }//class Directories

    kingspalace wrote:
    Dr Clap
    The problem i am having is that whereas i am very sure that there are contents in the files i am trying to read , this part of the code Print the Values of parentPath,directory.getParent() and file.getName() here .In the start of this if condition to get a idea what stuff is coming here.
    if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                   {Are you trying to compare parentPath and directory.getParent() as Strings ? How about using equals() ?
    Also are you aware that a single & and && are not one and the same ?
    & will check nevertheless even if the string comparison on the parentPath returns true or false.
    && will not check file.getName() part if the String comparison part fails.
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
                             }How about adding a simple Exception catch block here ,in case you miss anything ?
    never gets executed executed (meaning ,according to the code, the files am reading have no content ). i am a bit new to files and directories in java . i am hence seeking advice on what i could be doing wrong .IN short,debugging your code will help you a lot.

  • Getting null values from nodes using DOMParser

    Hi
    I'm having problems retrieving the values from an XML doc.
    I'm using the DOMParser, but instead of retrieving the values
    from the nodes, I just get null.
    Code fragment :
    DOMParser parser = new DOMParser();
    parser.parse(url);
    XMLDocument doc = parser.getDocument();
    NodeList nl = doc.getElementsByTagName("*");
    Node n;
    iNode = nl.getLength();
    for (int i=0; i<iNode; i++)
    n = nl.item(i);
    String szNodeName = n.getNodeName();
    System.out.print(szNodeName+ " (" );
    System.out.print(n.getNodeValue()+")");
    System.out.println();
    The result is
    course (null)
    Name (null)
    All the node names are correct, but the node values are NOT
    displayed.
    Any idea ?
    Rodrigo
    null

    According to the DOM Level 1 spec, the "value" of an ELEMENT node
    is null and the getNodeValue() method will always return null for
    an ELEMENT type node. You have to get the TEXT children of an
    element and then use the getNodeValue() method in the text nodes.
    Oracle XML Team
    Rodrigo Loureiro (guest) wrote:
    : Hi
    : I'm having problems retrieving the values from an XML doc.
    : I'm using the DOMParser, but instead of retrieving the values
    : from the nodes, I just get null.
    : Code fragment :
    : DOMParser parser = new DOMParser();
    : parser.parse(url);
    : XMLDocument doc = parser.getDocument();
    : NodeList nl = doc.getElementsByTagName("*");
    : Node n;
    : iNode = nl.getLength();
    : for (int i=0; i<iNode; i++)
    : n = nl.item(i);
    : String szNodeName = n.getNodeName();
    : System.out.print(szNodeName+ " (" );
    : System.out.print(n.getNodeValue()+")");
    : System.out.println();
    : The result is
    : course (null)
    : Name (null)
    : All the node names are correct, but the node values are NOT
    : displayed.
    : Any idea ?
    : Rodrigo
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • No getter method for property user of bean Problem

    Hi everyone,
    I am new to this struts. I have a samll application to check login. When I run my application I get this message in my server console
    No getter method for property user of bean org.apache.struts.taglib.html.BEAN
    I saw the previous forum for the same topic. I have checked my property names start with appropriate cases. Here is my code
    %@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html>
    <head><title>Login</title></head>
    <body>
    <html:form action="submit.do">
    <table width="100%" border="0" height=75%>
    <tr>
    <td align="right" >UserName: </td>
    <td><html:text property="user"/></td>
    <tr>
    <tr>
    <td align="right" >Password: </td>
    <td><html:text property="password"/></td>
    </tr>
    <tr>
    <td colspan=2 align="center"><html:submit/></td>
    </tr>
    <tr>
    <td colspan=2 align="center"><html:errors/></td>
    </tr>
    </table>
    </html:form>
    </body>
    </html>
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.*;
    import java.util.*;
    * @author skannan
    * To change this generated comment edit the template variable "typecomment":
    * Window>Preferences>Java>Templates.
    * To enable and disable the creation of type comments go to
    * Window>Preferences>Java>Code Generation.
    public class LoginForm extends ActionForm
    private String user = null;
    private String password = null;
    /* user */
    public String getUser()
    return (this.user);
    public void setUser(String user)
    this.user = user;
    /* password */
    public String getPassword()
    return (this.password);
    public void setPassword(String password)
    this.password = password;
    public ActionErrors validate(ActionMapping mapping,
    HttpServletRequest request) {
    // Log the forms data
    servlet.log("Lastname:" + user);
    servlet.log("Address:" + password);
    // Check for mandatory data
    ActionErrors errors = new ActionErrors();
    if (user == null || user.equals("")) {
    errors.add("User", new ActionError("error.user"));
    if (password == null || password.equals("")) {
    errors.add("Password", new ActionError("error.password"));
    return errors;
    I am missing anything in my config files. Please I need help.
    Thanks!

    I did check my struts-config file
    Here is the part of my file
    <!-- ========== Form Bean Definitions ================= -->
    <form-beans>
    <form-bean name="loginForm"
    type="kannan.struts.trailer.checkin.LoginForm"/>
    <form-bean name="checkInForm"
    type="kannan.struts.trailer.checkin.CheckInForm"/>
    </form-beans>
    <!-- ========== Action Mapping Definitions ============ -->
    <action-mappings>
    <action path="/submit"
    type="kannan.struts.trailer.checkin.LoginAction"
    name="loginForm"
    input="/login.jsp"
    scope="request">
    <forward name="success" path="/checkIn.jsp"/>
    <forward name="failure" path="/login.jsp"/>
    </action>
    Still I am getting the error

  • When passing Node to parse() method get NULL pointer exception.

    All,
    I trying to pass a Node to parse method to get the NodeType object back and getting
    null pointer exception.
    Example
    xml
    <root>
    <Test>
    <someData>ABC</someData>
    </Test>
    </root>
    if pass the Test node to get Test object back I am getting null pointer exception.
    Thanks for all ur help
    Shoeb

    file 2
    ~~~~
    import javax.swing.*;
    public class ExtendedPage extends BasePage
    private JTextField objJTextField = null;
    private JButton objJButtonBrowse = null;
    Change the line in bold to
    private JTextField objJTextField;
    And everything works.

  • Weblogic JMS EJB : ThreadLocal access query : getting null in same thread

    We have two applications(one is jms and other is ejb) on single instance of weblogic managed server.
    On receving a new jms message the jms application call the ejb application by passing the new xml message.
    ejb application creates a threadlocal object and allocated transaction id to this transaction. I want to access this transactionid(present in threadlocal) in my jms application. But i am getting null.
    I believe i am in the same thread as i printing the thread number in the both the application log. I verified that same thread number was present for multiple messages
    in both logs [Except if one scenario of thread pooling is present that when jms calls ejb it frees the thread(23) and when ejb completes its job if gives back the thread(23) to jms...but it resets thread local]
    I need answer to following question
    1. Why is my transaction id null when i access through jms application.
    2. I believe i am in the same jvm instance.
    3. I believe i am in the same thread instance...( looking at logs except if someone can tell me i am not.....)
    4. Or if there is alternative solution to pick up threadlocal variable in my jms application.
    JMS application is new application trying to connect to existing ejb application which had the thread local design and we want to use that existing architecture before we decide to change. We need the transactionid for log corelation.

    I assume that either your JMS destination is backed by a database or your application is doing some database operations in the same transaction as the JMS send operation. I suspect that there is some kind of database maintenance process going on every night, which causes the database operations to be slow or not responding, which in turn causes the MDB transaction that the JMS send operation participates in to timeout.

  • URGENT: I am getting Null in my JSP

    Below is my bean containing all the data access logic - the jsp file follows also is my presentation file, when i render i get null value at display, do anyone know why?
    Help me experts.
    import java.io.Serializable;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    public class Licensee implements Serializable {
    private String artist_name;
    private String recording_title;
    private String Code;
    private String title;
    private String email;
    private String contact;
    public static Connection getConnection() throws Exception {
    String driver = "oracle.jdbc.driver.OracleDriver";
    String url = "jdbc:oracle:thin:@IP
    String username = "username";
    String password = "password";
    Class.forName(driver);
    Connection conn = DriverManager.getConnection(url, username, password);
    return conn;
    public void ConnectMe() {
    ResultSet rs = null;
    Connection conn = null;
    PreparedStatement pstmt = null;
    try {
    conn = getConnection();
    String query = "SELECT code, title, email, contact " +
    "FROM address '";
    pstmt = conn.prepareStatement(query); // create a statement
    //pstmt.setInt(1, 1001); // set input parameter
    rs = pstmt.executeQuery();
    //extract data from the ResultSet
    while (rs.next()) {
    setCode(rs.getString(1));
    setTitle(rs.getString(2));
    setEmail(rs.getString(3));
    setContact(rs.getString(4));
    System.out.println(Code + " " + title + " " + email + " " +
    contact + " ");
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    try {
    rs.close();
    pstmt.close();
    conn.close();
    } catch (SQLException e) {
    e.printStackTrace();
    public String getArtist_name() {
    return artist_name;
    public void setArtist_name(String artist_name) {
    this.artist_name = artist_name;
    public String getRecording_title() {
    return recording_title;
    public void setRecording_title(String recording_title) {
    this.recording_title = recording_title;
    public String getCode() {
    return this.Code;
    public void setIseries_Code(String Code) {
    this.Code = Code;
    public String getTitle() {
    return this.title;
    public void setTitle(String title) {
    this.title = title;
    public String getEmail() {
    return this.email;
    public void setEmail(String email) {
    this.email = email;
    public String getContact() {
    return this.contact;
    public void setContact(String contact) {
    this.contact = contact;
    This is my JSP file
    <jsp:useBean id="param" class="com.catco.rrd.Licensee"/>
    <jsp:setProperty name="param" property="*" />
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Simulating the RRD protype application</title>
    </head>
    <center>
    <body>
    <table width="900">
    <tr>
    <td>Iseries Code</td>
    <td>Title</td>
    <td>Contact</td>
    <td>Email</td>
    </tr>
    <tr>
    <td><%= param.getEmail() %>
    </td>
    <td><%= param.getTitle() %></td>
    <td><%= param.getEmail() %></td>
    <td><%= param.getEmail() %></td>
    </tr>
    </table>
    </body>
    </center>
    </html>
    If i run the project and and render the jsp in browser i get null values for the get event. Can someone spot what i am doing wrong here?

    mport java.io.Serializable;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    public class Licensee implements Serializable {
    private String artist_name;
    private String recording_title;
    private String Code;
    private String title;
    private String email;
    private String contact;
    public static Connection getConnection() throws Exception {
    String driver = "oracle.jdbc.driver.OracleDriver";
    String url = "jdbc:oracle:thin:@IP
    String username = "username";
    String password = "password";
    Class.forName(driver);
    Connection conn = DriverManager.getConnection(url, username, password);
    return conn;
    public void ConnectMe() {
    ResultSet rs = null;
    Connection conn = null;
    PreparedStatement pstmt = null;
    try {
    conn = getConnection();
    String query = "SELECT code, title, email, contact " +
    "FROM address '";
    pstmt = conn.prepareStatement(query); // create a statement
    //pstmt.setInt(1, 1001); // set input parameter
    rs = pstmt.executeQuery();
    //extract data from the ResultSet
    while (rs.next()) {
    setCode(rs.getString(1));
    setTitle(rs.getString(2));
    setEmail(rs.getString(3));
    setContact(rs.getString(4));
    System.out.println(Code + " " + title + " " + email + " " +
    contact + " ");
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    try {
    rs.close();
    pstmt.close();
    conn.close();
    } catch (SQLException e) {
    e.printStackTrace();
    public String getArtist_name() {
    return artist_name;
    public void setArtist_name(String artist_name) {
    this.artist_name = artist_name;
    public String getRecording_title() {
    return recording_title;
    public void setRecording_title(String recording_title) {
    this.recording_title = recording_title;
    public String getCode() {
    return this.Code;
    public void setIseries_Code(String Code) {
    this.Code = Code;
    public String getTitle() {
    return this.title;
    public void setTitle(String title) {
    this.title = title;
    public String getEmail() {
    return this.email;
    public void setEmail(String email) {
    this.email = email;
    public String getContact() {
    return this.contact;
    public void setContact(String contact) {
    this.contact = contact;
    This is my JSP file
    <jsp:useBean id="param" class="com.catco.rrd.Licensee"/>
    <jsp:setProperty name="param" property="*" />
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Simulating the RRD protype application</title>
    </head>
    <center>
    <body>
    <table width="900">
    <tr>
    <td>Iseries Code</td>
    <td>Title</td>
    <td>Contact</td>
    <td>Email</td>
    </tr>
    <tr>
    <td><%= param.getEmail() %>
    </td>
    <td><%= param.getTitle() %></td>
    <td><%= param.getEmail() %></td>
    <td><%= param.getEmail() %></td>
    </tr>
    </table>
    </body>
    </center>
    </html>{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Getting null value while parsing "XML String" with  encoding WINDOWS-1252.

    Hi,
    when I am converting the Follwoing "xml string " to Document, I am getting the "null" as a document value.
        String strXML =  "<?xml version="1.0" encoding="WINDOWS-1252"?>
                              <category name="SearchByAttributes" value="Search By Attributes">
                                <item name="ORDER_LINE_ID" description="Application Search Attributes" >
                                   <attribute name="Sequence" value="0001"/>
                                 </item>
                                </category>"      
    My "xml string" has the encoding vaule: WINDOWS-1252.
    I am using the following code to convert the "xml string" to Document. I am getting the Document values as a "null" while converting the above "string xml"
            String strXML = //my above string xml.
            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
            docBuilderFactory.setIgnoringElementContentWhitespace(true);
            docBuilder = docBuilderFactory.newDocumentBuilder();
            doc = docBuilder.parse(new InputSource(new StringReader(strXML)));              
            System.out.println("doc value.."+doc)//I am getting null value for "doc".
    Can anyone help me to resolve the issue.

    Thagelapally wrote:
    I am coverting the below "XML string" to Document, once it is converted I am reading that Document,which have an "attribue" Element in.
      String strXML = "<?xml version="1.0" encoding="WINDOWS-1252"?>
    <category name="SearchByAttributes" value="Search By Attributes">
    <item name="ORDER_LINE_ID" description="Application Search Attributes" >
    <attribute name="Sequence" value="0001"/>
    </item>
    </category>" I am using the above code to read the Document. When run the code in "OC4J Server" and using Jdeveloper as an editor,I am able to perfectly read the "attribute" element in the document with out any problem.Println statement printing as I expected.
    System.out.println("Element Name..."+listOfAtt.getNodeName());
    //getting Element Name as...."attribute"(as expected)
    System.out.println("Element Attibrute list....."+elementAtt);
    //getting Element Attribute list as an...."oracle.xml.parser.v2.XMLAttrList@afe"But when run the same code(reading the same Document) in Tomcat and Eclipse,println satatement not printing as i expected.
    System.out.println("Element Name..."+listOfAtt.getNodeName());
    //getting Element Name as...."#text"(I am expecting output value "attribute" but it is printing "#text" which i don't know)
    System.out.println("Element Attibrute list....."+elementAtt);
    //getting Element Attribute list as an...."null"(I am expecting output value object reference but it is printing "null"
    (without the rest of the code, i'm guessing that) most likely you are grabbing the first child node of the item element. however, you are not accounting for some text nodes that are most likely in that list, like the whitespace between the item element and the attribute element. please go read some tutorials on xml, there are thousands of them out there, and they will answer all you initial questions much more efficiently than posting each step to the forums.

  • **URGENT** No getter method for property searchText of bean org.apache.stru

    I'm implementing a query page as described in the HowTo ADF_ComplexMasterDetail.zip
    When running the query page, I'm receiving the error:
    javax.servlet.jsp.JspException: No getter method for property searchText of bean org.apache.struts.taglib.html.BEAN
    I have my searchEmployees writen and 'exposed' (at least I can see it in the Data palette). But seems like something is missing, and can't find this searchText beam property specified in the html:text tag.
    Can someone help in this one?
    Here is the Help description inside the HowTo example:
    Section 3
    queryEmployees
    queryEmployeesInDept provides an interface for entering a simple search criteria for querying a list of
    employees. This does not use the Find mode Query By Example functionality that the other query screens
    use, but rather presents a much simpler search interface. The actual search is carried out using a
    function
    searchEmployees that the underlying view object exposes. (See the EmployeesView view object in the
    model project)
    1. Drop a new Data Page onto the page flow diagram call it queryEmployees
    2. In the page flow diagram, drag the searchEmployees operation from the AllEmployeesView
    collection in the Data Control Palette and drop it on top of the new Data Page. This will cause the
    framework to run a search whenever the page is called.
    3. In the Structure pane, locate the queryEmployees node and expand it, select the child node
    paramNames[0], and change it's value attribute to ${param.searchText}. This will pass the URL
    parameter searchText on to the business method to qualify the query.
    4. Drill down into the page and expand the Data Control Palette to select the AllEmployeesView
    collection. Set the Drag and Drop as: list to Read-OnlyTable. Then drag the collection onto the page.
    This will create a tabular containing the query results.
    5. Select the Struts HTML component palette and drag a Form onto the page above the output table. Set
    the handling action to this Data Page (queryEmployees.do)
    6. Drag a text field from the component palette inside of this new form. Set the property attribute of
    the
    <html:text> tag to searchText (the same value you used in the paramNames[0] for the Data Page)
    7. Create a new submit button in the form to submit the search. Set the property attribute of the button
    to
    event_search.
    8. Finally we need to subclass the data page to prevent the search action from being fired when it is not
    appropriate for the page ( for instance when we first display it). To do this we need to Go to Code on
    the Data Page's context menu, and override the invokeCustomMethod() method:
    * We only want to invoke the custom method i.e. the call to change
    * the Where clause on the collection, if the Action has been called with
    * a search event on the page with a search term supplied.
    * If the user got here via a link or another event, we bypass the model call
    * unless a URL parameter event=search is supplied, in which
    * case the method will also be called.
    protected void invokeCustomMethod(DataActionContext actionContext)
    List events = actionContext.getEvents();
    // If the event is "search" do the custom event call
    if ((events != null) && (events.contains("search")))
    String searchTerm = (String)((DynaActionForm)actionContext.getActionForm())
    Get("searchText");
    if (searchTerm != null)
    super.invokeCustomMethod(actionContext);
    }

    Solved with Oracle JDeveloper HowTo:
    Creating Search Pages with Both Fixed and Dynamic Criteria
    Author: Steve Muench, Oracle ADF Development Team
    Date: September 16, 2004
    http://www.oracle.com/technology/products/jdev/howtos/10g/dynamiccrit/index.html

Maybe you are looking for

  • The Startup Disk utility is missing from Preference Panel.

    I recently realized that I no longer have the Startup Disk preference pane in the Preferene Panel. I sometimes boot from other drives and now I'm forced to hold down the option key at restart or startup instead of being able to select the startup dri

  • Backup Macbook 10.5.8

    I have a MacBook with 10.5.8 processor and I would like to backup the computer with an external hard drive.  It is a Toshiba.  Can you tell me the steps I need to do to get Time Machine to backup my Mac? Thanks

  • Help! Connection pointbase error

    i used webserver7.0. this is my server.xml: <jdbc-resource> <jndi-name>jdbc/sample</jndi-name> <datasource-class>com.pointbase.jdbc.jdbcUniversalDriver</datasource-class> <property> <name>password</name> <value>PBPUBLIC</value> </property> <property>

  • AirPort Express vs. Extreme

    I'm looking to set up a wireless home network. Do I need the Airport Extreme, or will an Express work? All I use right now is an iMac and AppleTV. I'd like to set up a secure network for the two rather than use sharing via the iMac. Any info/opinions

  • OPEN SQL Aggregate Function

    Hi , I want to display no. of invoice by month and yearwise . eg.      JAN     FEB     MAR     APR      ..... 2008      10     15     7     8      ...... 2009     9     87     7     77      ... is it any easy way to retirve from RBKP - BUDAT using ag