Unable to run URL from a servlet program

Hi ,
I have some problems in executing a URL which is coded to run the reports in HTML format from the J2EE-Oracle Web application. The servlet is coded to set the browser properties such as content type, content length, etc....The content length is -1 when this URl is run. Find below the servlet code which is currently used,
/// code starts here
private String executeReportUsingURL(String[] command)
          throws IOException,ClassNotFoundException,SQLException,InterruptedException {
String filePath = "";
try
String paramString = "&otherparms=YES&";
getp.info("In executeReportUsingURL method --- " + command);
getp.info("In executeReportUsingURL method --- " + command);
int len = command.length;
String requestString="";
String desfileFormat="";
for(int k=9;k<len;k++)
String tempParam = command[k];
getp.info(tempParam);
System.out.println(tempParam);
if (k!=(len-1))
paramString=paramString + tempParam + "&";
}else
paramString=paramString + tempParam;
getp.info("Al Ansari Exchange: "+paramString);
System.out.println("Al Ansari Exchange: "+paramString);
               for(int i=0;i<len;i++)
                                        desfileFormat=command[5].toString();
getp.info("Request String "+requestString);
System.out.println("Request String "+requestString);
String urlString = resource.getString("reportGeneratorUrl");
DataOutputStream dataoutputstream;               
BufferedReader bufferedreader;
getp.info("URL string Before accessing : "+urlString);
System.out.println("URL string Before accessing : "+urlString);
java.util.Properties properties = System.getProperties();
Security.addProvider(new Provider());
properties.put("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
System.setProperties(properties);
getp.info("URL STRING : " + urlString);
System.out.println("URL STRING : " + urlString);
String userId = gitResource.getString("userid");
String finalURLString ="";
getp.info(" file format "+desfileFormat);
System.out.println(" file format "+desfileFormat);
if(desfileFormat.equals("desformat=html"))
finalURLString = urlString + "?destype=file&desformat=html&server=ce&report="+rdfFileName+"&userid=" + userId + paramString;
else
finalURLString = urlString + "?destype=cache&desformat=pdf&server=ce&report="+rdfFileName+"&userid=" + userId + paramString;               
getp.info("Final String "+finalURLString);
System.out.println("Final String "+finalURLString);
url = new URL(finalURLString);               
int bfr = 128;
String aafilename = null;
String actfilename = null;
URLConnection uc = url.openConnection();
getp.info("1");
System.out.println("1");
uc.setRequestProperty("Content-Type","text/html; charset = windows-1256" );
String ct = uc.getContentType();
getp.info("2");
System.out.println("2");
int cl = uc.getContentLength();
getp.info("3");
System.out.println("3");               
getp.info("4");
System.out.println("4");
InputStream theImage = uc.getInputStream();
getp.info("5");
System.out.println("5");
byte[] b = new byte[cl];
int bytesread = 0;
int offset = 0;
int tempoffset = 0;
getp.info("6");
System.out.println("6");
while (bytesread >= 0) {
if ((cl - offset) < 128)
bfr = cl - offset;
getp.info("7");
System.out.println("7");
bytesread = theImage.read(b, offset, bfr);
tempoffset = offset;
if (bytesread == -1) break;
offset += bytesread;
     getp.info("8");
     System.out.println("8");
                    if (offset != cl) {
System.err.println("Error: Only read " + offset + " bytes");
System.err.println("Expected " + cl + " bytes");
getp.info("9");
System.out.println("9");
String theFile = url.getFile();
theFile = theFile.substring(theFile.lastIndexOf('/') + 1);
String randomno = null;
getp.info("10");
System.out.println("10");                    
getp.info(" rep src folder with path "+reportSourceFolderWithPath);
System.out.println(" rep src folder with path "+reportSourceFolderWithPath);
getp.info(" outputfile "+outputFileName);
System.out.println(" outputfile "+outputFileName);
filePath = reportSourceFolderWithPath + outputFileName;
FileOutputStream fout = new FileOutputStream(filePath);
getp.info("Writing file for after getting result from reports :"+filePath);
System.out.println("Writing file for after getting result from reports :"+filePath);
getp.info("12");
System.out.println("12");
fout.write(b);
getp.info("122");
System.out.println("122");
          catch (Exception e)
               throw new InterruptedException(e.getMessage());
               return filePath;
     // end of code
Regards
Mirza

Mirza,
Please post the entire error message and stack trace you are getting.
Since you say the code you posted is from a servlet, then what servlet engine are you using? You seem to imply that it is Oracle Application Server. Or maybe it's just OC4J stand-alone? Please provide details of the application server you are using.
By the way, you can use the [ code ] and [ /code ] tags (without the spaces) to format your code.
Good Luck,
Avi.

Similar Messages

  • Create a url from a report program

    Hi All,
    Could anyone please suggest me how do i generate a url from a report program. I need to use this generated url then, as a link in an excel sheet.
    Thanks in advance,
    Warm Regards,
    Preethi.

    Hi Preethi,
    REPORT  ZAZUURL                                 .
    DATA: BEGIN OF URL_TABLE OCCURS 10,
    L(25),
    END OF URL_TABLE.
    URL_TABLE-L = 'http://www.lycos.com'.APPEND URL_TABLE.
    URL_TABLE-L = 'http://www.hotbot.com'.APPEND URL_TABLE.
    URL_TABLE-L = 'http://www.sap.com'.APPEND URL_TABLE.
    LOOP AT URL_TABLE.
      SKIP. FORMAT INTENSIFIED OFF.
      WRITE: / 'Single click on '.
      FORMAT HOTSPOT ON.FORMAT INTENSIFIED ON.
      WRITE: URL_TABLE. HIDE URL_TABLE.
      FORMAT HOTSPOT OFF.FORMAT INTENSIFIED OFF.
      WRITE: 'to go to', URL_TABLE.
    ENDLOOP.
    CLEAR URL_TABLE.
    AT LINE-SELECTION.
    IF NOT URL_TABLE IS INITIAL.
      CALL FUNCTION 'WS_EXECUTE'
           EXPORTING
                program = 'C:\Program Files\Internet Explorer\IEXPLORE.EXE'
                commandline     = URL_TABLE
                INFORM         = ''
              EXCEPTIONS
                PROG_NOT_FOUND = 1.
      IF SY-SUBRC <> 0.
         WRITE:/ 'Cannot find program to open Internet'.
      ENDIF.
    ENDIF.
    <b>Regards,
    Azhar</b>

  • Error :Unable to retrieve data from iHTML servlet for Request2 request

    I open bqyfile to use HTML in workspace.
    When I export report to excel in IR report.
    Then I press "back" button I get error"Unable to retrieve data from iHTML servlet for Request2 request "
    And I can not open any bqyfiles in workspace.
    Anybody gat the same question? Thanks~

    Hi,
    This link will be helpful, the changes is made in the TCP/IP parameter in the registry editor of Windwos machine. I tried the 32 bit setting for my 64 bit machine (DWORD..) and it worked fine for me..
    http://timtows-hyperion-blog.blogspot.com/2007/12/essbase-api-error-fix-geeky.html
    Hope this helps..

  • Opening a URL from a Java Program

    Hi all,
    Can I open Internet Explorer and invoke a URL from a Java Program. If it can be done, could someone please give a code for that.
    Thanks in advance.

    Did you try it like "start \"http://java.sun.com\""
    or maybe
    "start 'http://java.sun.com'"I've no idea whether that will work, but it would be the first thing I'd try.

  • Unable to open url from email

    suddenly today i am unable to open url link from my eudora mail program. firefox is my default browser. never had this problem before.

    This could be a Launch Services issue. The following article describes how to manually reset Launch Services — the notes at the bottom of the article also provide information about the side effects of deleting each of the files involved:
    Resetting Launch Services
    If you prefer using a cache cleaning utility instead of following the manual procedure described in the previous article, take a look at this other article for general troubleshooting and cache-cleaning procedures. Actually, you should also verify/repair the startup disk (not just permissions), as described there:
    Resolving Disk, Permission, and Cache Corruption
    The most appropriate utility for this particular problem probably is Tiger Cache Cleaner, but you may also want to consider other utilities, such as OnyX, or Cache Out X, which are free. Whatever utility you choose, be sure to read this first:
    Side effects of System cache cleaning
    As an example, this is how you should proceed with OnyX:
    1. Quit all applications.
    2. Launch OnyX and enter your administrator password.
    3. Go to Maintenance > Reset and check LaunchServices database.
    4. Un-check any other pre-checked options.
    5. Click the Execute button.
    6. Restart the computer.
    BTW, if you’re running Mac OS X 10.4 (Tiger), as your profile indicates, it would have been more appropriate to discuss this in the Mail & Address Book - Tiger forum. If the discussion applies to both Mail 1.x and Mail 2.x, it doesn’t really matter, but it’s difficult to know that in advance.

  • FRM-41214 unable to run report from forms with parameters

    Hi all,
    I am unable to run a report from forms if I pass parameters. Report is running fine in reports builder and in url if I access the report straightly.
    I used set_report_object_property to pass the parameters.
    Any clues to solve this problem?
    Priya

    Hi Jeneesh,
    Code is below:
    myreport1 :=find_report_object('MYREP');
    reportdata := Get_Parameter_List('reportsdata');
    IF NOT Id_Null(reportdata) THEN
    Destroy_Parameter_List( reportdata );
    END IF;
    reportdata := Create_Parameter_List('reportsdata');
    Add_Parameter(reportdata, 'account_number', TEXT_PARAMETER, :parameter.account_number);
         /* Setting the properties into Report Object */
         SET_REPORT_OBJECT_PROPERTY(myreport1, REPORT_COMM_MODE, SYNCHRONOUS);
         SET_REPORT_OBJECT_PROPERTY(myreport1, REPORT_DESTYPE, CACHE);
         SET_REPORT_OBJECT_PROPERTY(myreport1, REPORT_DESFORMAT, 'htmlcss');
         SET_REPORT_OBJECT_PROPERTY(myreport1, REPORT_SERVER,vc_reportserver);
                   SET_REPORT_OBJECT_PROPERTY(myreport1, REPORT_FILENAME, 'C:\priya\forms\EmcySummary.jsp');
              SET_REPORT_OBJECT_PROPERTY(myreport1,REPORT_OTHER,'account_number='|| :parameter.account_number);
         /* Value of v_rep identifies the report that is currently running either locally or on a remote report server */
         vrep := RUN_REPORT_OBJECT(myreport1,reportdata);
    /* Checking for Report Server is started or not, if not throw an exception else proceed */
         if vrep = vrep||'_0'then
         raise form_trigger_failure;
    end if;
         vjob_id := substr(vrep,length(vc_reportserver)+2,length(vrep));
         vrep_status := REPORT_OBJECT_STATUS(vrep);
         /* Checking the status of the report */
         WHILE vrep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
    LOOP
    vrep_status := report_object_status(vrep);
    END LOOP;
    /* When the report status is successful then report is generated in Web */
         IF vrep_status = 'FINISHED' THEN
         --     COPY_REPORT_OBJECT_OUTPUT(vrep,v_tempstorage);
              WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||vjob_id||'?server='||vc_reportserver, '_blank');
         END IF;
    ---Any clues?

  • Unable to run query from BEx query designer

    Hello,
    I am connecting remotely to clients environment. I am not able to run query from Bex query designer. System generates IE window with URL
    http://server.com:50300/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?QUERY=ZCOPCM02_Q017&VARIABLE_SCREEN=X&DUMMY=9
    but query result isnt shown.
    Internet Explorer cannot display the webpage.
    What kind of setting do I need to change to get query working?
    thanks

    Hi Comandante,
    If you are not able to Execute the Query using Query designer, you can also execute the query using RRMX  or RSRT transaction for now until the issue with the query designer is solved ..
    Hope it helps!
    Regards,
    Pavan

  • Error on running JVM from a C program

    Hello there!!
    I'm using Open Watcom as a C compiler on Windows XP. I'm trying to run a JVM from a C program.
    I have specified the following as a library file :
    C:\Java\jdk1.5.0_04\lib\jvm.lib
    The code compiles very well, but I'm getting an error when running it.
    Windows tells me the following :
    "The entry point of the function ??_7VM_GetCurrentLocation@@6B@ can't be found in jvm.dll dynamic linking library"
    The code I've been trying to run is the following one :
    #include <jni.h>
    #include <stdio.h>
    #include <stdlib.h>
    void main()
    JavaVMOption options[3];
    JavaVMInitArgs vm_args;
    JavaVM *jvm;
    JNIEnv *jenv;
    long result;
    jmethodID mid;
    jfieldID fid;
    jobject jobj;
    jclass cls;
    int asize;
    printf("coucou\n");
    getchar();
    options[0].optionString = ".";
    options[1].optionString = "-Djava.compiler=NONE";
    options[2].optionString = "-verbose:jni";
    vm_args.version = JNI_VERSION_1_2;
    vm_args.options = options;
    vm_args.nOptions = 3;
    vm_args.ignoreUnrecognized = JNI_FALSE;
    JNI_GetDefaultJavaVMInitArgs(&vm_args);
    result = JNI_CreateJavaVM(&jvm,(void **)&jenv, &vm_args);
    /* if(result == JNI_ERR )
    printf("Error invoking the JVM");
    exit (-1);
    cls = (*jenv)->FindClass(jenv,"C:\Formation\Joly\FromCtoJava\WATCOM\samples\ide\win32\FromCtoJava");
    /* if( cls == NULL )
    printf("can't find class FromCtoJava\n");
    exit (-1);
    (*jenv)->ExceptionClear(jenv);
    mid=(*jenv)->GetMethodID(jenv, cls, "<init>", "()V");
    jobj=(*jenv)->NewObject(jenv, cls, mid);
    fid=(*jenv)->GetFieldID(jenv, cls, "arraySize", "I");
    asize=(*jenv)->GetIntField(jenv, jobj, fid);
    printf("size of array is %d",asize);
    (*jvm)->DestroyJavaVM(jvm);*/
    Cheers
    Joly

    I already did PATH.
    Open a console window.
    Explicitly set PATH to point ONLY to the appropriate java directory (where the dll is and executable) using something like the following
    set PATH=C:\xxx\yyy
    Then run your app again in the console window - no where else.

  • Running Tomcat from a java program

    I'm writing a program that shall run Tomcat from the program itself. The eacy way would be to just call org.apache.catalina.startup.Bootstrap.main(String[]) in a new thread, but that gives only a little information to the program about the state of the server. Actually I would only know when the server is told to start (just before the main method is called), and when the server had stopped (just after the main method).
    I have browsed the Catalina API documentation and source code for hours, but the only solution I have gotten, writes the standard startup text:
    Starting service Tomcat-Standalone
    Apache Tomcat/4.0.4
    Starting service Tomcat-Apache
    Apache Tomcat/4.0.4If I could get that to work, I would could add a LifecycleListener, and get all the info. I need.
    The essence of the code I use is this:
    CatalinaService cs = new org.apache.catalina.startup.CatalinaService();
    Server s = new StandardServer();
    StandardService stdService = new org.apache.catalina.core.StandardService();
    s.addService(stdService);
    cs.setServer(s);
    cs.process(new String[]{"start"});but the following also produce a simmilar result:
    BootstrapService b = new org.apache.catalina.startup.BootstrapService();
    b.load(new TomcatLoader(),null);
    b.start();A dirty solution would be to copy the code form Bootstrap.main(String[]) and add a few lines, but I really dosn't like that. It would be a nightmare to maintain, primiarry because I would loose the functionallity of Catalinas class loader (where a lof of classes is loaded).
    Does anybody know how I can get Tomcat to run, so I still get my info. and don't use any dirty solutions?

    Check out the main method in the source code of class org.apache.catalina.startup.Embedded
    It should help you.
    Also check out this article
    http://www.onjava.com/pub/a/onjava/2002/04/03/tomcat.html

  • Unable to run reports from forms using run_report_object

    Hi All,
    I am unable to run a report(9i) from forms(9i) in client side.
    I used the following code
    Declare
         repid REPORT_OBJECT;
         v_rep varchar2(100);
         rep_status varchar2(20);
    Begin     
         repid := FIND_REPORT_OBJECT('report4');
         v_rep := RUN_REPORT_OBJECT(repid);
    End;
    I get the following error
    FRM-41219 : Cannot find report:invalid ID.
    Any help will be highly appreciated.
    Thanks,
    Sanjay

    Hi All,
    I am unable to run a report(9i) from forms(9i) in client side.
    I used the following code
    Declare
         repid REPORT_OBJECT;
         v_rep varchar2(100);
         rep_status varchar2(20);
    Begin     
         repid := FIND_REPORT_OBJECT('report4');
         v_rep := RUN_REPORT_OBJECT(repid);
    End;
    I get the following error
    FRM-41219 : Cannot find report:invalid ID.
    Any help will be highly appreciated.
    Thanks,
    Sanjay Hi
    You have to create a report object within the form.
    If you look at the Object NAvigator in the Form Builder right below Record Group
    tou would see an option for Report. Create a new report object.
    Set the following properties for that object
    Filename - This should be the name of your RDF file you created from Report Builder along with the full path.
    Set the Execution Mode, Communication Mode and Report Destination Type as per your requirements.
    In the parameter for find_report_object() pass the name of the report object you created.
    eg.
    if the name of the report object you created is Report2 then
    your call should be rep_id := find_report_object('Report2') .
    You are calling the report object which has been created in your form builder and through that call you are running the report file specified in the Filename property of that report object.
    Regards
    Poorvi

  • Unable to run reports from the unix command line

    hi
    all of a sudden i am unable to run reports ( on App server 10g) either from the unix scripts or from the unix command line. But i can run them from the forms.
    Any one have any idead about this.
    Thank you

    thanks all for replying
    i have set the env variables for the session and it worked. Looks like i have to set the oracle_home and ld_library_path every time ( opening a new putty session) i call sqlldr.
    But in a whole i am trying to run sql loader from the forms. Right now we have Oracle app server 10g which forms 10g version. As oracle app server 10g didnt come with sqlldr, we are copied the sqlldr of database on to app server with different home. after this we can run sqlldr ( on app server ) from unix scripts but not from Forms. Then we opened a qurey with oracle about app server 10g not commig with sqlldr and its remedy . But they said that they dont have specific remedy for that and suggested the same what we did.
    So we came up with java package which does the same funtion as host command and trying to run sqlldr which is on the database( ie replacing the host command in the forms with the database funtion). By using that funtion i am able to run the sqlldr from sql plus but not from forms. I couldnt easily debug it as i wont through any error messages.
    Any one have any idea of this ...
    Thank you

  • Unable to run page from Jdeveloper frequently getting JRADXML related error

    Hi all,
    Regarding this problem I have tried the solution suggested by Tapashray and tcesenthil on thread Unable to run the page from JDeveloper
    but still the problem persists.
    After deleting transaction.state and restarting the jdev also the problem persists.
    Any solution for this issue ?
    Thanks in advance,
    Anant Nimbalkar.

    what is the error that you are getting ?
    Thanks
    Tapash

  • Running ssh from within java program

    Hi!
    I am trying to start ssh from within java e.g.:
    Runtime run = Runtime.getRuntime();
    Process pro = run.exec("ssh -l xx 12.12.12.12");
    But it complains:
    socket: Operation not permitted
    ssh: connect to host 12.12.12.12 port 22: Operation not permitted
    Running ssh from the command prompt works just fine. It's run on win xp.
    What is the problem, and how can I avoid it?
    Endre

    Afraid not. I think maybe it's related to security permissions, but I am really not sure. If you can help, I would appreciate it.
    - Endre

  • Unable to run report from forms developer.

    hi....
    i m not very much in developer 9i.from last 2 month i m doing developer 9i.I m desiging and running
    report from report builder.but i m not able to run that report from forms developer.Can anyone help to solve my problem?is there any particular extension i have to follow or any configuration(Application server) i have to made change?What code i have to write to run a report from forms?

    Hi frank...
    Thanx for ur reply...
    Actually what i did,i created a report and save that report with .rdf extension.I set reports_path(In Registry) property to the particular folder where i put all of my reports.In forms developer i add the report as report object from that folder.i set the following few lines in a button click event
    --=============================================
    declare
    rep_id report_object;
    v_rep varchar2(30);
    begin
    rep_id :=find_report_object('report4');
    v_rep :=run_report_object(rep_id);
    end;
    --=============================================
    when i click the button it is showing a error "You didnot specify the report name".This is all about from me what i did to run a report from forms.So should i do to run report?

  • Unable to load dll from a servlet

    Hey iam new to jni and serlets but this is what iam doing...
    I have a cell phone application and when the application is invoiked it sends data to a servlet and the serlet replies which works fine. I wrote native method in java and a dll for that and I created a test class in java to see if the dll works. I run the test program and I get the output from the dll, this works fine.
    Now when my phone application invokes the serlet it create a object of the class which has a native method call and calls that method and the servlet sends the output back tothe phone, however this doesnt seem to work.
    The error I get is
    java.lang.unsatisfiedlinkerror no <dllname> in java.library.pathat java.lang.classloader.loadlibrary.
    Now by this error I guess that I need to register/set the path for the dll with java.library.path.
    thanks
    jai

    Try giving the path of the DLL in the start command of the webserver
    i.e. -Djava.library.path="Dir where the DLL is present".
    Hope this should help.
    Dhamo.

Maybe you are looking for

  • Error in PREP_INIT/VERSCHK_INI phase during upgrade to NW70 EHP1 SR1

    Hi All, We have a NW system with the following components to NW 70 EHP1 SR1: SAP_ABA     700     0013     SAPKA70013     Cross-Application Component SAP_BASIS     700     0013     SAPKB70013     SAP Basis Component PI_BASIS     2005_1_700     0013   

  • Why do my .pdf docs open in MS Word?

    My.pdf docs open in MS Word instead of Adobe Reader.

  • Cutover activities and cutover data

    Hi , Can anybody pl. tell me what is cutover strategy or cutover activities? What are cutover data is there?Is there any specific activity in pp Regards

  • Guide lines in Acrobat

    Dear People, How can i create in Adobe Acrobat Pro "Guide Lines" that will appear on each page visible. Cause if i create a guide line in Adobe Acrobat Pro, it's only on one page visible and its not possible to copy and paste it ons same place, so fa

  • Where can I download the working jdbc for JDev-10.1.2?

    Hi! I've read a lot on this forum about the bug in JDev-10.1.2 - there are errors ora-00604 and ora-12705 in establishing connection with Oracle DB by using own jdbc. The solution of this problem is substituting jdbc from previous release JDev, for e