Stopsap is not working in Java ystem

Hi All,
We have a Java system connected to XI. stopsap command is not working when I try to shutdown the java system. I have to kill all the processes to stop the Java. The error that I am getting is the following. I used <SID>adm user to stop the Java system. We need to fix this. Please help ASAP.
stopping the SAP instance J00
Shutdown-Log is written to /home/JP2adm/stopsap_J00.log
/usr/sap/JP2/J00/exe/sapcontrol -prot NI_HTTP -nr 00 -function Stop
stop of Instance failed
See /home/JP2adm/stopsap_J00.log for details
Trace of system startup/check of SAP System JP2 on Mon Feb  7 16:54:02 CST 2011
Called command: /usr/sap/JP2/SYS/exe/uc/rs6000_64/stopsap stop
stopping the SAP instance J00
/usr/sap/JP2/J00/exe/sapcontrol -prot NI_HTTP -nr 00 -function Stop
07.02.2011 16:54:03
Stop
FAIL: HTTP error, HTTP/1.1 401 Unauthorized
stop of Instance failed
Thanks,
Kavitha.
Edited by: Kavitha Rajan on Feb 9, 2011 5:26 PM

Thank you Sarbjeet. Your answer is very helpful.
Thanks again,
Kavitha Rajan.

Similar Messages

  • Applets not working with Java 1.7.0_51 in MII 14.0 SP4 Patch 5

    Hi,
    I'm currently evaluating the migration of our MII 12.0 developments to MII 14.
    But I'm running in several issues just trying to use simple things like a SQL query template with an iGrid Display template in test mode.
    Used versions are: MII 14.0 SP4 Patch 5 and on client side the latest Mozilla Firefox with Java 1.7.0_51
    At first I always get a java security warning when the applet is being loaded about unsigned applications.
    At second the applet itself is not running. It always shows "No data available" and the java console shows the following errors (iResult is the id of the applet):
    iResult [ERROR] - Couldn't set query template: No Query Defined
    iResult [ERROR] - Couldn't set display template: null
    iResult [ERROR] - Couldn't set display template: null
    Is this perhaps a general problem, that the MII applets are not working with Java 1.7.x versions?
    If I call the same MII page from a client with Java 1.6.x it is working without errors.
    Do you have some suggestions for me?
    Regards Timo

    please clear your JAVA Cache. that should solve the JRE issue. thanks

  • BAPI not working in Java Webdynpro

    Hi,
    My BAPI from SAP is working in Netweaver perfectly, but when I call the same with the equal parameters in Java webdynpro, no results.
    I'm using following function: 'CVAPI_DOC_VIEW'.
    Any idea why the BAPI is not working in Java Webdynpro?
    Regards,
    Tim

    Hi Tim,
    AFAIK 'CVAPI_DOC_VIEW'  will work only in standard SAP Dynpro. Inside Webdynpro it is forbidden to save files in the background and using GUI class with execute, so you cannot use that Standard FM.
    Check this thread .
    Thanks
    Katrice

  • Why windows command prompt is not working with java

    I installed java 1.6 to my computer (Laptop) and it is perfectly working with Netbeans and Eclipse
    but not working with windows xp xommand prompt
    It compiles the code but when it is going to run it throw the following exception
    Exception in thread "main" java.lang.UnsupportedClassVersionError: Example (Unsupported major.minor version 50.0)
            at java.lang.ClassLoader.defineClass0(Native Method)
            at java.lang.ClassLoader.defineClass(Unknown Source)
            at java.security.SecureClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.access$100(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)I've reinstalled java 1.6, but the output is same
    Please help me to get it correct
    Thank you

    E:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracl
    e\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Progr
    am Files\Microsoft SQL Server\90\Tools\binn\;C:\OrCAD\OrCAD_10.0\tools\pcb\bin;C
    :\OrCAD\OrCAD_10.0\tools\specctra\bin;C:\OrCAD\OrCAD_10.0\tools\bin;C:\OrCAD\OrC
    AD_10.0\tools\PSpice\Library;C:\OrCAD\OrCAD_10.0\tools\fet\bin;C:\OrCAD\OrCAD_10
    .0\tools\jre\bin;C:\OrCAD\OrCAD_10.0\tools\Capture;C:\Program Files\QuickTime\QT
    System\;C:\Program Files\Java\jdk1.6.0_01\bin;C:\Program Files\Microsoft Visual
    Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev9
    8\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Mic
    rosoft Visual Studio\VC98\bin;

  • Dynamic configuration not working in Java mapping

    Hi All,
    I have a scenario where i  am using java mapping. In this i am doing following
    1)Read file name from input message header
    2)set file name in output message Header
    3) set Directory name in output message Header
    i  have used following code .. but iit is not working... when i test end  to end...  in reciver communication channel it is failing stating " message failed as "Directory is not set in Header. Also i checked in SXMB_MONI  "dynamic configuration".It is not showing Directory.
    this is code.
    public void transform(TransformationInput transformationInput,TransformationOutput transformationOutput)
                   throws StreamTransformationException {
                   private Map para;
                   String Directory ;
                   String  inputFileName;
                   String var1 = "ABC";
                   para = transformationInput.getInputHeader().getAll();
                   DynamicConfiguration conf = (DynamicConfiguration) para
                             .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
                   DynamicConfigurationKey keyFileName1 = DynamicConfigurationKey
                   .create("http://sap.com/xi/XI/System/File", "FileName");
                         inputFileName = conf.get(keyFileName1);
                   DynamicConfigurationKey keyFilename = DynamicConfigurationKey
                             .create("http://sap.com/xi/XI/System/File", "FileName");
                   DynamicConfigurationKey keyDirecory = DynamicConfigurationKey
                             .create("http://sap.com/xi/XI/System/File", "Directory");
                   Directory = "tmp/"+var1;
                   conf.put(keyFilename,inputFileName);
                   conf.put(keyDirecory, Directory);
    I am in PI 7.1 ,   and in eclipse its showing warning that Para is not used.
    Can anyone show some lights.
    Also is there any way to debug this?? like is there any function by which i can write the trace for each step to see those in MONI.

    Method name:   public void createDirectory(Resultlist result, Container container)throws StreamTransformationException
    //Use Simple UDF and do the following lines
    String Directory ;
    String  inputFileName;
    String var1 = "ABC";
    DynamicConfiguration conf = container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
      DynamicConfigurationKey keyFileName1 = DynamicConfigurationKey
                   .create("http://sap.com/xi/XI/System/File", "FileName");
      inputFileName = conf.get(keyFileName1);
    DynamicConfigurationKey keyFilename = DynamicConfigurationKey
                   .create("http://sap.com/xi/XI/System/File", "FileName");
    DynamicConfigurationKey keyDirecory = DynamicConfigurationKey
                   .create("http://sap.com/xi/XI/System/File", "Directory");
    Directory = "tmp/"+var1;
    conf.put(keyFilename,inputFileName);
    conf.put(keyDirecory, Directory);
    and remove these 3 lines
    //private Map para;
    //para = transformationInput.getInputHeader().getAll();
    //DynamicConfiguration conf = (DynamicConfiguration) para.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION
    >>I am in PI 7.1 , and in eclipse its showing warning that Para is not used.Can anyone show some lights.
    You can simply remove declaring Map Para line... The eclipse gives warning because you dont assign values for it and you are trying to use...
    For using the same input file name in output side, you dont need coding ... you need only for the directory...
    Enable ASMA attributes in the channel.
    Edited by: Baskar Gopal on Feb 24, 2011 10:58 AM

  • {@inheritDoc} not working for Java Classes

    Hello,
    i am using {@inheritDoc} for inherting super class's JavaDoc for a perticular function..
    It is working, if super class is my own class. i am able to see all JavaDoc in child class.
    But when i use {@inheritDoc} for extending JavaDoc of java class it is not working.
    i.e. if i am writing {@inheritDoc} in public void actionPerformed(ActionEvent e) method..
    It wont show any javadoc..
    How to add it? Do i need to give source of java classes too???
    And if it is Yes, then where to specifiy. and where to find source of Java classes, do they come with JDK? or NetBeans?? (If yes then where it is in JDK or Netbeans???)
    Thanks,
    Nachiket.

    Yes, you need to have the Java source, with the -sourcepath option, as described here:
    Inheriting Comments from J2SE - Your code can also automatically inherit comments from interfaces and classes in the J2SE. You can do this by unzipping the src.zip file that ships with the SDK (it does not contain all source files, however), and add its path to -sourcepath. When javadoc runs on your code, it will load the doc comments from those source files as needed. For example, if a class in your code implements java.lang.Comparable, the compareTo(Object) method you implement will inherit the doc comment from java.lang.Comparable.
    http://java.sun.com/j2se/javadoc/faq/#incrementalbuild
    If you want the full Java source get it from here:
    http://www.sun.com/software/communitysource/j2se/java2/index.xml
    http://java.sun.com/j2se/javadoc/faq/#sourcecode
    -Doug

  • Reposting ! string concatanation not working in java

    hi I am using the following code to construct a string and i see that it seems that the correct string is made but the application does not run
    if i just cut n paste the same string into command prompt it works fine . please advise :
    also note iam costructing string in two way , but using stringbuffer and by using , but both ways dont work.
    If the parameter is just one word for example say "Testing" then the shell command works fine which tells me that the string concatanation is not working or embedding some special chars?
    public static void main(String args[]) {
    String s = null;
    // system command to run
    String quotes="\"";
    String parameter = quotes args[0] quotes;
    String cmd = "awtrap -f 10.200.16.17 -h 10.100.10.112 -p 162 -c fdot 1.3.6.1.4.1.791.2.9.2 6 4 1.3.6.1.4.1.791.2.9.2 -s " parameter;
    System.out.println(cmd);
    File workDir = new File("/opt/CA/SharedComponents/ccs/atech/services/bin");
    StringBuffer sb = new StringBuffer();
    sb.append("awtrap -f 10.200.16.17 -h 10.100.10.112 -p 162 -c fdot 1.3.6.1.4.1.791.2.9.2 6 4 1.3.6.1.4.1.791.2.9.2 -s ");
    sb.append("\"");
    sb.append(args[0]);
    sb.append("\"");
    String str2 = sb.toString();
    System.out.println(str2);
    try {
    Process p = Runtime.getRuntime().exec(cmd, null, workDir);
    ========================================== below is the run log ============================================
    awtrap -f 10.200.16.17 -h 10.100.10.112 -p 162 -c fdot 1.3.6.1.4.1.791.2.9.2 6 4 1.3.6.1.4.1.791.2.9.2 -s "testing 2"
    awtrap -f 10.200.16.17 -h 10.100.10.112 -p 162 -c fdot 1.3.6.1.4.1.791.2.9.2 6 4 1.3.6.1.4.1.791.2.9.2 -s "testing 2"
    usage: /opt/CA/SharedComponents/ccs/atech/services/bin/awtrap [-v 1 | 2c | 3] [-i] [-r retries] [-f from_addr | from_host]
    [-h dest_addr | dest_host] [-p port] [-t timeout ] [-d logLevel]
    [-c community] enterprise type [subtype] [oid oidtype value]
    ================================= now if I just cut n paste the string on command prompt it runs fine =====================
    Pt$ awtrap -f 10.200.16.17 -h 10.100.10.112 -p 162 -c fdot 1.3.6.1.4.1.791.2.9.2 6 4 1.3.6.1.4.1.791.2.9.2 -s "testing 2"
    Pt$

    I am putting the code in code tags and in preview it shows up perfect, can you see it now ?
    import java.io.File;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.InputStream;
    public class RunSystemCommand {
    public static void main(String args[]) {
    String s = null;
    // system command to run
    String quotes="\"";
    String parameter = quotes + args[0] + quotes;
    String cmd = "awtrap -f 10.200.16.17 -h 10.100.10.112 -p 162 -c fdot 1.3.6.1.4.1.791.2.9.2  6 4 1.3.6.1.4.1.791.2.9.2 -s " + parameter;
    System.out.println(cmd);
    File workDir = new File("/opt/CA/SharedComponents/ccs/atech/services/bin");
    StringBuffer sb = new StringBuffer();
    sb.append("awtrap -f 10.200.16.17 -h 10.100.10.112 -p 162 -c fdot 1.3.6.1.4.1.791.2.9.2  6 4 1.3.6.1.4.1.791.2.9.2 -s ");
    sb.append("\"");
    sb.append(args[0]);
    sb.append("\"");
    String str2 = sb.toString();
    System.out.println(str2);
    try {
    Process p = Runtime.getRuntime().exec(cmd, null, workDir);
    int i = p.waitFor();
    if (i == 0){
    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    // read the output from the command
    while ((s = stdInput.readLine()) != null) {
    System.out.println(s);
    else {
    BufferedReader stdErr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    // read the output from the command
    while ((s = stdErr.readLine()) != null) {
    System.out.println(s);
    catch (Exception e) {
    System.out.println(e);
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • J2EE_ADMIN not working in Java Side

    Hi All,
    The J2ee_admin Id is not working on the Java side, but is working on the ABAP Side. I changed the password of SAPJSF, is it bcoz of that? If yes, pls suggest what can be done.
    Regards,
    Divya

    Hi Divya,
    You can Activate the Emergency User (find the directions at http://help.sap.com/saphelp_nw04/helpdata/en/3a/4a0640d7b28f5ce10000000a155106/content.htm ).
    The you can login using the SAP* account. After which you can go in to the User Administrator and update the j2ee_admin account password. Then logout, disable the Emerengy User (SAP*), and login using the j2ee_admin account.
    hope this would resolve your issue. If still it persists, do revert.
    Regards,
    P. Kumaravel.
    Ps: Award points for heelpful answers.

  • SDM still not working with Java v6u15

    I keep waiting for Java to work some day with their updates on Cisco SDM. Update 14 at least allowed SDM to open. But the new update 15 still hasn't passed the test of clicking on the Configure button and then the Additional Task button. It just doesn't do anything. If it is something that Cisco can fix, please be aware.
    Thanks,
    .. Jim ..

    Hi Jim, you need to downgrade the JAVA version on the computer you want to use SDM.
    SDM does not support java after: 6u3.
    Cisco SDM requires Sun Java Runtime Environment (JRE). The following versions are supported:
    •JRE 1.5_09
    •JRE1.4.2_08
    •JRE 1.5.0_06
    •JRE 1.5.0_07
    •JRE 1.6.0_02
    •JRE 1.6.0_03
    As per the release notes.
    http://www.cisco.com/en/US/docs/routers/access/cisco_router_and_security_device_manager/software/release/notes/SDMr25.html
    This will resolve your issue.
    Cisco does not plan to fix this as SDM is end of life.
    The product that replaces SDM is CCP: Cisco Configuration Professional, that one works with JAva 6 update 14, but it's a different product. It's also a freeware you can download from our website.

  • Mapping editor not working with Java 5 classes

    I have a small protoype web service which I wrote using Tomcat/Axis/Spring/Hibernate and using EJB3 annotations for the mappings. I want to port the persistence layer to Toplink.
    I installed Toplink 9.0.4.1 and added the toplink libraries to my project and implemented the DAO and the spring bean defs.
    I opened the mapping editor and created a project. When I try to add classes to it for mapping I get an error that it can't find the classes (even though I selected them from the chooser). I figured it might be that they were compiled with Java 5, so I switched the JRE_HOME in setenv.cmd to my Java 5 JRE. Now I can import the classes and see the attributes but when I click on any of them in the Navigator panel, the editor panel remains blank. If I now try to save, I get:
    java.lang.NullPointerException
         at oracle.toplink.workbench.ui.tools.CheckListModel.getRowCount(CheckListModel.java:119)
         at javax.swing.JTable.checkLeadAnchor(JTable.java:2949)
         at javax.swing.JTable.tableChanged(JTable.java:2993)
         at javax.swing.JTable.setModel(JTable.java:2827)
         at oracle.toplink.workbench.ui.tools.CheckList.initialize(CheckList.java:47)
         at oracle.toplink.workbench.ui.tools.CheckList.<init>(CheckList.java:26)
    It seems that the mapping workbench doesnt work with Java 5. What should I do?

    Ah, I see. I saw another post here stating that must use 10.1.3.

  • WebStart Application is not working in Java 7 u45

    My Eclipse RCP application ( launched with WebStart (.jnlp)) crashes on startup while launching with Java 7 u45.
    I've added to the manifest:
    Permissions: all-permissions
    Codebase: *
    Trusted-Library: true
    This removed all of the warning messages from the Control Panel. But I still have a loading issue. I see following messages (Missing Application-Library-Allowable-Codebase) in java console while  downloading many jarfs/plugins
    security: JAVAWS AppPolicy Permission requested for: http://vspdlpd05.atldev.com/PDTeller-v73allyusdev2ix/app/plugins/j2ee_1.6.0.jar
    ruleset: finding Deployment Rule Set for
            title: Profile Direct Teller Wrappering Feature
            location: http://vspdlpd05.atldev.com/PDTeller-v73allyusdev2ix/app/features/com.fnis.ally.teller.wrapper_2.0.0.jnlp
            jar location: http://vspdlpd05.atldev.com/PDTeller-v73allyusdev2ix/app/plugins/j2ee_1.6.0.jar
            jar version: null
            isArtifact: true
    ruleset: no rule applies, returning Default Rule
    network: Created version ID: 1.7.0.51
    network: Created version ID: 1.5+
    network: Created version ID: 0+
    security: Missing Application-Library-Allowable-Codebase manifest attribute for: http://vspdlpd05.atldev.com/PDTeller-v73allyusdev2ix/app/plugins/j2ee_1.6.0.jar
    where as the same changes (modified all the manifest files with above attributes) done in to a different repository seems to be working fine with java 7 u45.
    Any help would be appreciated.
    Thanks
    Sai

    Thanks Santhosh.
    I am going through the First help link, I have already set the Property(Standard mode - while Launching Portal in new window) from Portal iview, and "Handover Portal stylesheet" to 'NO'
    I hv already gone the remaining Forum threads and Notes as well, but i did not get exact any other help to fix this issue.
    I am getting different Error now - Unable to get property 'addDelegate' of undefined or null reference
    Pls. let me know if you can help me.
    Thanks
    Sathya

  • Xerces for XSD 1.1 Validation not working in Java Mapping

    Hi Experts,
    We are trying to use XSD 1.1 (assertion feature) validation for the XML payload in a Java mapping program. But I am getting the following exception:
    java.lang.IllegalArgumentException: http://www.w3.org/XML/XMLSchema/v1.1 at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:186)
    This is happing for the statement:
    SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1");
    The reason (apparently) is because it is not able to instantiate the class org.apache.xerces.jaxp.validation.XMLSchema11Factory , which is the Xerces implementation of the SchemaFactory class.
    I have tried following things so far -
    1. If I try to validate an xml against an xsd 1.1 schema in a standalone program, it works perfectly fine.
    2. If I try to deploy this whole functionality on to the server through an EAR (like an adapter module), there again it works.
    3. Also tried this before instantiating the SchemaFactory -
    System.setProperty("javax.xml.validation.SchemaFactory:http://www.w3.org/XML/XMLSchema/v1.1","org.apache.xerces.jaxp.validation.XMLSchema11Factory");
    4. I tried by creating the Imported Archive objects for all the Xerces jars that we require for validation, within the same SWCV, namespace. But still I get the same exception as above (IllegalArgumentException)
    5. The link [http://help.sap.com/saphelp_nw70/helpdata/en/b6/8097f5a5edea4f8dfc87ac87082b22/content.htm ] mentions that we need to place all the necessary jars at location <SAP_J2EE_Engine_install_dir>/cluster/server/bin/ext /. But even after placing the jars there, I get the same exception.
    I am not sure how we need to handle this. Has anybody faced a similar situation? Any suggestions?
    Regards,
    Sudheer

    Hi Stefan,
    Thanks for the reply.
    We are on PI 7.1 SP 06. The standard XML tools from jdk supports only XSD 1.0, as far as I know. And XSD 1.0 does not have the Assert feature (also known as, co-occurrence constraint). More details are provided here - [http://www.ibm.com/developerworks/library/x-xml11pt2/]
    To use XSD 1.1, we need a different implementation like Xerces-J. I am not sure how we can use it without external jars. I would like to mention again that I could achieve this by using an adapter module (EAR containing the jars), but I need to do this in Java Mapping (imported archive).
    Do you know how we can achieve this in any other way? Any other suggestions welcome.
    Thanks & Regards,
    Sudheer

  • Delete and renameto not working in java

    guys, i have written a java program that reads file1 into temp file and finally writes into another file. program is working fine with no errors, it even reported that the file is deleted. But actually the file was not deleted and renameto was never successful. could you guys see any problem with file definetion so that delete is not successful. please see code from 6th line from bottm.
    public class Mergewrs {public static void main (String[] args) throws IOException {
    /* Creates a new instance of mergewrsFile */
         /* Making sure an argument is specified */
         if(args.length > 0)
              String line           = null;
              String policyflag      = null;
              int addCnt          = 0;
              File mergein = new File("c:\\javat\\mergein.dat");
              /* Specifiying input file to be used */
              BufferedReader  inFile  = new BufferedReader(new FileReader(mergein));
              line = inFile.readLine();
              /* Read all lines in the wrsfile specified */
              while(line != null)
                   System.out.println("Process1: ");
                   policyflag      = line.substring(0,1);
                   // Reads input record from 2 thru 1025
                   String actionIndicator = new String();
                   if(policyflag != null && policyflag.equalsIgnoreCase("A"))
                        { actionIndicator = "A";
                          addCnt = addCnt+1;
                          process(actionIndicator, line);
                   catch(IOException e)
                        {System.err.println("File input error");}
                   line = inFile.readLine();
              } //while ends
         } //if ends
    public static void process(String actionIndicator, String line) throws IOException
         String line1 = null;
         String templine = null;
         String policyId = null;
         File policyOutfile = new File("c:\\javat\\mergeout.dat");
         File policyOutfileold = new File("c:\\javat\\mergeoutold.dat");
         BufferedReader  policyOut  = new BufferedReader(new FileReader(policyOutfile));
         File tempfile = new File("c:\\javat\\tempfile.dat");
         BufferedWriter tempout = new BufferedWriter(new FileWriter(tempfile));
         line1 = policyOut.readLine();
         try{
              policyId =line1.substring(150,165);
              while(line1 != null)
              {     policyId =line1.substring(150,165);
                   try
                        if(policyId.equals(line.substring(151,166)))
                             { templine =line1.substring(0,151);
                        else { templine=line1;}
                        tempout.write(templine);
                        tempout.newLine();
                        line1 = policyOut.readLine();
                   catch (Exception e) {System.err.println("File exception h");}
              } //while ends
              try { tempout.close(); }
              catch (Exception e) { e.printStackTrace();}
              try { policyOut.close(); }
              catch (Exception e) { e.printStackTrace();}
              try
                   if(policyOutfile.exists())
                        policyOutfile.delete();
                        tempfile.renameTo(policyOutfile);
              catch (Exception e) {System.out.println("error"); }
    }

    guys, i have written a java program that reads file1
    into temp file and finally writes into another file.
    program is working fine with no errors, it even
    reported that the file is deleted. But actually the
    file was not deleted and renameto was never
    successful. could you guys see any problem with file
    definetion so that delete is not successful. please
    see code from 6th line from bottm.Since you don't actually do anything with the return value how do you know it was successful?

  • Auto Boxing not working in Java 6?

    Hi All,
    I am studying and practicing to become Java Certified and I am just using an example from the Java Certification Guide Chapter 11 Swing Components from Sybex for Java 5.
    I am using Eclipse and the latest Java 6 SDK in WIndows XP.
    The code below runs fine in Solaris 10 using Java 1.5.0_14-b03:
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class StringLengthTableModel extends AbstractTableModel {
         private String[] strings;
         public StringLengthTableModel(String[] strings) {
              this.strings = strings;
         public int getRowCount() {
              return strings.length;
         public int getColumnCount() {
              return 2;
         public Object getValueAt(int row, int col) {
              if (col == 0) {
                   return strings[row];
              } else {
                   return strings[row].length();
         public String getColumnName(int col) {
              return (col == 0) ? "String" : "Length";
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              String[] strings = { "January", "February", "March", "April", "May",
                        "June", "July", "August", "September", "October", "November",
                        "December" };
              StringLengthTableModel model = new StringLengthTableModel(strings);
              JTable table = new JTable(model);
              frame.getContentPane().add(table);
              frame.setSize(500, 250);
              frame.setVisible(true);
    However in Windows XP and using the latest Eclipse IDE and the Latest Java 6 SDK I get:
    Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
         Type mismatch: cannot convert from int to Object
    The questionable method line is
                   return strings[row].length();
    in the method
         public Object getValueAt(int row, int col) {
              if (col == 0) {
                   return strings[row];
              } else {
                   return strings[row].length();
    Any ideas????
    You would think and hope the latest release of Java like Java 6 would be backward compatible with the auto boxing and auto un boxing features that were introduced in Java 5.
    Any comments, thoughts, ideas would be appreciated.
    Thanks,
    Carlos A. Morillo
    [email protected]

    CarlosMorillo wrote:
    Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
         Type mismatch: cannot convert from int to ObjectGo to that line in Eclipse and look for the red squiggly line. Click on the I symbol next to it. At a guess the project is set up to work in 1.4 mode.
    Also learn to love the "Problems" panel. This should not have been a runtime error.
    Any ideas????Your project is in 1.4 mode. Right click on the project in the "Project Explore" window. Select properties, select "Java Compiler", check the "Enable project specific settings" and make sure the little drop downs all say "6.0".

  • URL class is not working in Java 1.4. However works in Java 1.3

    I have a Java program which uses URL classes through FTP connection to open any files. It works fine in Java 1.3 version. However the same program fails with
    java.io.FileNotFoundException: at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream
    when using Java 1.4 version.
    Here is the part of source code.
    try
    URL url ;
    url = new URL("ftp://"); // I have not given the full connect string here.
    URLConnection connection = url.openConnection();
    BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine) ;
    in.close();
    catch(Exception e)
    System.out.println("Error occured " + e.getMessage());
    Anyone has ideas about what is going wrong and how to correct that. I appreciate your reply.
    Thanks

    Here is the original code. I have not given the password and using as "anonymous". Again this code works fine in Java1.3. But not in Java1.4 . I appreciate your help .Is it something I have to set up in UNIX side. The exact error is
    <p>
    "Exception in thread "main" java.io.FileNotFoundException: oraom/temp.log
    at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnec
    tion.java:333)
    at java.net.URL.openStream(URL.java:913)
    at temp.main(temp.java:17) "
    <P>
    import java.net.*;
    <P>
    import java.io.*;
    <P>
    import java.util.*;
    <P>
    public class temp
    <P>
    <P>
    public static void main(String args[]) throws Exception
    <P>
    <P>
    URL url = new URL("ftp://oraom:anonymous@oradev:/oraom/temp.log");
    <P>
    try
    <P>
    <P>               
    URLConnection connection = url.openConnection();
    <P>
    connection.setDoInput(true);
    <P>
    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
    <P>
         String inputLine;
    <P>
         while ((inputLine = in.readLine()) != null)
    <P>
         System.out.println(inputLine) ;
    <P>
         in.close();
    <P>
    <P>
    catch(Exception e)
    <P>
    <P>
    throw e;
    <P>
    <P>                                                  
    <P>
    <P>
    </P>

Maybe you are looking for