Invoking OS commands from JSP
Hi!
I am trying to invoke underlying Operating System's commands such as cd, or calling a batch file from my JSP.
I achieve this by doing as below:
String command = "cd temp";
Process process = Runtime.getRuntim().exec(command);
I need to know the current directory where this command would be invoked.
How can I get the path? It's very urgent!
Look forward to your response...
Thanks in advance.....
Sandesh
actually, nevermind. that won't be the current directory. It will be this:
String dir = System.getProperty("user.dir");
Similar Messages
-
Shell commands from JSP after Forms migration
During application migration from forms 9i to JSP & BC4J, I have to code the following Forms code into my JSP application.This is for a button pressed trigger.
DECLARE
RENAME_STRING VARCHAR2(120):= 'RENAME C:\BRC\PDATA' ||:DRAWING_ACCOUNTS.ACCOUNT_ID|| '.TXT P' || :DRAWING_ACCOUNTS.ACCOUNT_ID || TO_CHAR(SYSDATE,'DDMMYY')|| '.txt';
BEGIN
HOST( RENAME_STRING, no_screen );
web.show_document( 'http://hostname/selectfile.html', '_new');
IF NOT Form_Success THEN
Message('Error -- File not Renamed.');
END IF;
END;
How can I do this simple sending of OS commands in JSP, any ideas?Hi,
Not only rename commands but I have to pass several other os commands like 'sqlldr' for data upload as well. Therefore, I need a reusable piece of code for that. I have acheived some way for that using the following code.
put the following file in that package.
package BankrecBC4J;
import java.util.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.zip.*;
class StreamGobbler extends Thread
InputStream is;
String type;
StreamGobbler(InputStream is, String type)
this.is = is;
this.type = type;
public void run()
try
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null)
System.out.println(type + ">" + line);
} catch (IOException ioe)
ioe.printStackTrace();
public class GoodWindowsExec
private static final boolean NATIVE_COMMANDS = true;
//Allow browsing and file manipulation only in certain directories
private static final boolean RESTRICT_BROWSING = false;
//If true, the user is allowed to browse only in RESTRICT_PATH,
//if false, the user is allowed to browse all directories besides RESTRICT_PATH
private static final boolean RESTRICT_WHITELIST = false;
//Paths, sperated by semicolon
//private static final String RESTRICT_PATH = "C:\\CODE;E:\\"; //Win32: Case important!!
private static final String RESTRICT_PATH = "/etc;/var";
* Command of the shell interpreter and the parameter to run a programm
private static final String[] COMMAND_INTERPRETER = {"cmd", "/C"}; // Dos,Windows
//private static final String[] COMMAND_INTERPRETER = {"/bin/sh","-c"}; // Unix
* Max time in ms a process is allowed to run, before it will be terminated
private static final long MAX_PROCESS_RUNNING_TIME = 30 * 1000; //30 seconds
//Normally you should not change anything after this line
//Change this to locate the tempfile directory for upload (not longer needed)
private static String tempdir = ".";
private static String VERSION_NR = "1.1a";
private static DateFormat dateFormat = DateFormat.getDateTimeInstance();
public GoodWindowsExec(String g)
System.out.println(" hello " + g);
/*if (g.length < 1)
System.out.println("USAGE: java GoodWindowsExec <cmd>");
System.exit(1);
try
String osName = System.getProperty("os.name" );
String[] cmd = new String[3];
System.out.println("here ");
if( osName.equals( "Windows NT" ) )
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = g;
else if( osName.equals( "Windows 2000" ) )
System.out.println("Windows 2000");
cmd[0] = "command.com" ;
cmd[1] = "/C" ;
cmd[2] = g;
else if( osName.equals( "Windows XP" ) )
System.out.println("Windows XP");
cmd[0] = "command.com" ;
cmd[1] = "/C" ;
cmd[2] = g;
else if( osName.equals( "Windows 95" ) )
cmd[0] = "command.com" ;
cmd[1] = "/C" ;
cmd[2] = g;
Runtime rt = Runtime.getRuntime();
System.out.println("Execing " + cmd[0] + " " + cmd[1]
+ " " + cmd[2]);
Process proc = rt.exec(cmd);
* Starts a native process on the server
* @param command the command to start the process
* @param dir the dir in which the process starts
// any error message?
StreamGobbler errorGobbler = new
StreamGobbler(proc.getErrorStream(), "ERROR");
// any output?
StreamGobbler outputGobbler = new
StreamGobbler(proc.getInputStream(), "OUTPUT");
// kick them off
errorGobbler.start();
outputGobbler.start();
// any error???
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
} catch (Throwable t)
t.printStackTrace();
* Converts some important chars (int) to the corresponding html string
static String conv2Html(int i) {
if (i == '&') return "&";
else if (i == '<') return "<";
else if (i == '>') return ">";
else if (i == '"') return """;
else return "" + (char) i;
static String startProcess(String command, String dir) throws IOException {
StringBuffer ret = new StringBuffer();
String[] comm = new String[3];
comm[0] = COMMAND_INTERPRETER[0];
comm[1] = COMMAND_INTERPRETER[1];
comm[2] = command;
long start = System.currentTimeMillis();
try {
//Start process
Process ls_proc = Runtime.getRuntime().exec(comm, null, new File(dir));
//Get input and error streams
BufferedInputStream ls_in = new BufferedInputStream(ls_proc.getInputStream());
BufferedInputStream ls_err = new BufferedInputStream(ls_proc.getErrorStream());
boolean end = false;
while (!end) {
int c = 0;
while ((ls_err.available() > 0) && (++c <= 1000)) {
ret.append(conv2Html(ls_err.read()));
c = 0;
while ((ls_in.available() > 0) && (++c <= 1000)) {
ret.append(conv2Html(ls_in.read()));
try {
ls_proc.exitValue();
//if the process has not finished, an exception is thrown
//else
while (ls_err.available() > 0)
ret.append(conv2Html(ls_err.read()));
while (ls_in.available() > 0)
ret.append(conv2Html(ls_in.read()));
end = true;
catch (IllegalThreadStateException ex) {
//Process is running
//The process is not allowed to run longer than given time.
if (System.currentTimeMillis() - start > MAX_PROCESS_RUNNING_TIME) {
ls_proc.destroy();
end = true;
ret.append("!!!! Process has timed out, destroyed !!!!!");
try {
Thread.sleep(50);
catch (InterruptedException ie) {}
catch (IOException e) {
ret.append("Error: " + e);
return ret.toString();
In the first line of the JSP file include the package
<%@page import="BankrecBC4J.*" %>
and call
it this way:from the jsp page
new GoodWindowsExec ("calc"); //
which should open up the calciulator, and should do for other os commands as well.
Thanks -
Problem in invoking BPEL process from jsp
Dear Experts,
I am trying to invoke BPEL process from simple JSP form, with guide lines of http://download.oracle.com/docs/cd/B31017_01/integrate.1013/b28981/invoke.htm. But I'm receiving the following error
Error: JSP files must reside in the server root directory or a subdirectory beneath it
Note: I having my JSP page inside my project folder-->output_html--> myfile.jsp
Thanks,
RajeshHi Rajesh,
Please refer \bpel\samples\tutorials\102.InvokingProcesses\jsp.
BPEL Tutorial 7: Invoking BPEL Processes through SOAP and Java : Reference: 2004/06/14/orabpel/d5/1.0
Hope this helps!
Regards
Anirudh Pucha -
Invoking dos commands from java
hi all,
I just want to invoke dos prompt from java.I know it can be done using "Runtime.getRuntime()" command.But when i try to create a directory inside another directory,how can i specify the path of the destination directory.i googled as well as tried different things.But i failed to make it up.Please help me solve this problem.
thanks in advance
RegardsHai,
Thanks for your respond.
If I give "cmd" command only, I am getting dos command window, but I didn't get the prompt like
c: or d:
How can I do it?
Expecting more helps
Joseph -
Executing a DOS Command from JSP
How do i execute a Dos command from within JSP. I would like to execute a sql Loader command .
ThanksYou use Runtime.execute().
Take a look here for a few of the tricks involved in it:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html -
Simple invoking BPEL process from JSP not working
Hello Everybody,
I'm trying to invoke a BPEL process from a client JSP. I'm following the tutorial 7 Invoking the BPEL processes.
I'm trying to use the same tutorial for a different application.
Here is my WSDL snippet.
<types>
<schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://www.arcwebservices.com/v2006"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="SpatialQueryRequest" type="s1:SpatialQueryRequestType"/>
<element name="SpatialQueryResponse" type="s1:SpatialQueryResponseType"/>
<complexType name="SpatialQueryRequestType">
<sequence>
<element name="username" type="string"/>
<element name="password" type="string"/>
</sequence>
</complexType>
<complexType name="SpatialQueryResponseType">
<sequence>
<element name="token" type="string"/>
</sequence>
</complexType>
</schema>
</types>
<message name="SpatialQueryRequestMessage">
<part name="payload" element="s1:SpatialQueryRequest"/>
</message>
<message name="SpatialQueryResponseMessage">
<part name="payload" element="s1:SpatialQueryResponse"/>
</message>
<portType name="SpatialQuery">
<operation name="initiate">
<input message="tns:SpatialQueryRequestMessage"/>
</operation>
</portType>
<!-- portType implemented by the requester of SpatialQuery BPEL process
for asynchronous callback purposes
-->
<portType name="SpatialQueryCallback">
<operation name="onResult">
<input message="tns:SpatialQueryResponseMessage"/>
</operation>
</portType>
The JSP code is:
<%
String ssn = request.getParameter("ssn");
//if(ssn == null)
// ssn = "123-12-1234";
String username = "jaweed";
String password = "ibrahim";
//String xml = "<ssn xmlns=\"http://services.otn.com\">" + ssn + "</ssn>";
//String xml = "<UserName xmlns="http://www.arcwebservices.com/v2006">" + username + "</UserName><Password xmlns="http://www.arcwebservices.com/v2006">" + password + "</Password>";
String xml = "<UserName xmlns=\"http://www.arcwebservices.com/v2006\">" + username + "</UserName><Password xmlns=\"http://www.arcwebservices.com/v2006\">" + password + "</Password>";
Locator locator = new Locator("default","bpel");
IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
// construct the normalized message and send to Oracle BPEL Process Manager
NormalizedMessage nm = new NormalizedMessage( );
nm.addPart("payload", xml );
NormalizedMessage res = deliveryService.request("SpatialQuery", "initiate", nm);
Map payload = res.getPayload();
//out.println( "BPELProcess CreditRatingService executed!<br>" );
out.println( "Token is " + payload.get("payload") );
%>
com.oracle.bpel.client.ServerException: IDeliveryService.request() invoked for one-way operation 'initiate'. This method can only be used to invoke two-way operations which return an output message. Please check the WSDL which defines this operation and use the method IDeliveryService.post() to invoke a one-way operation
But I'm getting an exception. I'm in deep trouble please help me. UrgentYeah ..This is my final project for my masters degree.
I'm integrating BPEL with GIS(Geographic Information System) webservices provided by ESRI(Arcweb services). My main BPEL process that I built follows this sample example. The problem is that I need to show a working client application within 2 days or else my project is termed as incomplete and my graduation will be postponed to next semester. :(
I tried your advice, as soon as I add a Java code to my BPEL process, the application is taking longer time to execute in the BPEL console itself.
<bpelx:exec xmlns:bpelx="http://schemas.oracle.com/bpel/extension" language="java" version="1.4" name="exec-1">
<![CDATA[setConversationId("output");]]>
</bpelx:exec>
So after the thread sleep the webservice is not ready to give its output.
Just a quick thought, I assumed that if I attach the output of the my Invoke(Client) to a Reply activity,which will make it a two way operation.
Then I could use,
NormalizedMessage res = deliveryService.request("SpatialQuery", "initiate", nm);
will work.
I assigned the ouput of the Invoke(Client) to the variable in Reply activity.
But my reply activity is throwing a NULL pointer exception.
This is my BPEL code:
<sequence name="main">
<receive name="receiveInput" partnerLink="client" portType="tns:InvokeTest" operation="initiate" variable="input" createInstance="yes"/>
<assign name="assign-1">
<copy>
<from variable="input" part="payload" query="/nsxml0:InvokeTestRequest/nsxml0:username"></from>
<to variable="IsaInput" part="parameters" query="/nsxml0:getToken/nsxml0:username"/>
</copy>
<copy>
<from variable="input" part="payload" query="/nsxml0:InvokeTestRequest/nsxml0:password"></from>
<to variable="IsaInput" part="parameters" query="/nsxml0:getToken/nsxml0:password"/>
</copy>
</assign>
<invoke name="invoke-1" partnerLink="Authentication" portType="nsxml0:IAuthentication" operation="getToken" inputVariable="IsaInput" outputVariable="IsaOutput"/>
<assign name="assign-2">
<copy>
<from variable="IsaOutput" part="parameters" query="/nsxml0:getTokenResponse/nsxml0:Result"></from>
<to variable="output" part="payload" query="/nsxml0:InvokeTestResponse/nsxml0:token"/>
</copy>
</assign>
<reply name="reply-2" partnerLink="client" portType="tns:InvokeTest" operation="initiate" variable="output"/> </sequence>
I really appreciate your patience and help. -
Error 57 in invoking sqlplus command from DOS command prompt in Oracle Serv
I have a Oracle 11G server which has suddenly shutdown due to power cut-off. Now when I restart the system and trying to connect to database invoking the sqlplus as sysdba from DOS command prompt - I am getting following errors
C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
Error 57 initializing SQL*Plus
Error loading message shared library
Can anyone help me please ?Yes sure!! .. The details of alert logs for today is herewith -
Thu Feb 28 12:30:02 2013
kewastUnPackStats(): bad magic 1 (0x0DFE82DA, 0)
kewastUnPackStats(): bad magic 1 (0x0DFE82DA, 0)
Thu Feb 28 12:36:02 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:36:19 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m000_5180.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m000_5180.trc:
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:36:40 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:37:08 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:37:28 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:37:50 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:38:07 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m000_6256.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m000_6256.trc:
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:38:12 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:38:34 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:38:56 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:39:31 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:39:47 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m001_7628.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:39:49 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m001_7628.trc:
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:40:10 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:40:31 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_ckpt_3160.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Thu Feb 28 12:40:48 2013
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m002_2748.trc:
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error.
Errors in file d:\app\collbrs\diag\rdbms\collbrs\collbrs\trace\collbrs_m002_2748.trc:
ORA-00204: error in reading (block 1, # blocks 1) of control file
ORA-00202: control file: 'D:\APP\COLLBRS\ORADATA\COLLBRS\CONTROL01.CTL'
ORA-27070: async read/write failed
OSD-04006: ReadFile() failure, unable to read from file
O/S-Error: (OS 1117) The request could not be performed because of an I/O device error. -
How to invoke Oracle Reports from JSP ?
Hi,
I need to invoke Oracle Reports ( paper format ) from my JSP in different formats /PDF, RTF, HTML/ using rwservlet and then send the content to user browser.
Please, someone to give me working example.
Thanks in advance.
Best regards.
Peter.Peter,
you can call it from a URL if you need:
/reports/rwservlet?report=...&detype=cache&desformat=pdf...
You can define a file called cgicmd.dat on teh server that takes key-value pairs of the most common parameters under an named entry.
e.g.
ReportsCommon: destype=cache server=myServer ... %*
This way your URL is reduced to a minimum length because you don't have to list all parameters in teh URL.
Second solution:
Run a Reports from a browser URL and specify paramform=yes. This create a HTML based parameter form before executing teh Reports. Have a look at the HTML form code and see to what extend your Reports share same functionality so that you could create this HTML form in your JSP page. You could have a poplist with the name of "desformat" and list HTML, HTMLCSS,PDF,RTF,XML as valid entries so that the user can select the output format.
The Reports documentation shipped with Oracle9iAS (also available online otn.oracle.com/products/reports) has all teh information you need.
Frank -
How can one run OS commands from JSP's?
Hi
I figured out the perms problem I had, and running a java class that calls Runtime.exec() now works - apparently; in fact, it doesn't really run the OS command, but returns "OK".
Anyone have an idea how to make it actually run?
Thanks,
Paulo<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Paulo Rodrigues ([email protected]):
Hi
I figured out the perms problem I had, and running a java class that calls Runtime.exec() now works - apparently; in fact, it doesn't really run the OS command, but returns "OK".
Anyone have an idea how to make it actually run?
Thanks,
Paulo<HR></BLOCKQUOTE>
Hi Paulo, i use for that function the following code:
// JDC Tech Tips February 15, 2000
import java.io.*;
import java.util.ArrayList;
public class ExecDemo {
static public String[] runCommand(String cmd)
throws IOException {
// set up list to capture command output lines
ArrayList list = new ArrayList();
// start command running
Process proc = Runtime.getRuntime().exec(cmd);
// get command's output stream and
// put a buffered reader input stream on it
InputStream istr = proc.getInputStream();
BufferedReader br =
new BufferedReader(new InputStreamReader(istr));
// read output lines from command
String str;
while ((str = br.readLine()) != null)
list.add(str);
// wait for command to terminate
try {
proc.waitFor();
catch (InterruptedException e) {
System.err.println("process was interrupted");
// check its exit value
if (proc.exitValue() != 0)
System.err.println("exit value was non-zero");
// close stream
br.close();
// return list of strings to caller
return (String[])list.toArray(new String[0]);
public static void main(String args[]) throws IOException {
try {
// run a command
String outlist[] = runCommand("rm ./dummy");
// String outlist[] = runCommand("ls");
// display its output
for (int i = 0; i < outlist.length; i++)
System.out.println(outlist);
catch (IOException e) {
System.err.println(e);
Gert
null -
Invoking Microsoft Excel from jsp??
Hello:
Im going to install jdeveloper 903 and convert my application and I now want to add a button to call an excel spread sheet, is this possible? What are its limitations if any? Any input would be appreciated.To create excel files from Java have a look at Jakarta's POI project.
Also you might be interested in Java to COM bridges.
There are some companies creating those and there is also the open-source JACOB project.
A google search on any of these will get you there. -
Invoking BPEL process from a jsp
Hi,
I am invoking a synchronous BPEL process from a jsp.
The jsp I am using is pasted below for your reference.
createWorkOrderFFA.jsp invokes another jsp invokeWorkOrderFFA.jsp which inturn calls the BPEL process.
The code is given below.
-----------------createWorkOrderFFA.jsp starts-----------
<%@page import="com.oracle.bpel.client.Locator" %>
<%@page import="com.oracle.bpel.client.NormalizedMessage" %>
<%@page import="com.oracle.bpel.client.dispatch.IDeliveryService" %>
<html>
<head>
<title>Work Order Creation </title>
<meta http-equiv="PRAGMA" content="NO-CACHE" />
<meta http-equiv="EXPIRES" content="-1" />
<SCRIPT LANGUAGE="JavaScript">
function setfocus(){
document.generatePO.technicianName.focus();
function mypopup()
mywindow = window.open ("totalWODetails.jsp","mywindow","scrollbars=1,width=600,height=500");
mywindow.moveTo(50,50);
function DoTheCheck()
if((document.generatePO.repair.checked != true) && (document.generatePO.replacement.checked != true) &&(document.generatePO.emergency.checked != true))
alert('Please select atleast one task type for Work Order');
return false;
document.generatePO.submit();
return true;
function chkvalues(){
if( document.generatePO.additionalInfo.value == "")
alert(" Please provide additional information for tasks assigned");
document.generatePO.additionalInfo.focus();
return false;
return true;
</SCRIPT>
</head>
<body bgcolor = "#E9C2A6">
<br>
<tr cellspacing="0" cellpadding="0">
<td width="30%" align=left ><b><h2><font color="#3333CC"> </font></b></h2> </td>
</tr>
<!-- <h1 align='center'> Work Order Creation </h1> -->
<table border="1" cellspacing="0" cellpadding="0" width="80%" align=center>
<tr bgcolor=#A68064 valign=center > </tr>
<tr bgcolor=#A68064 valign==center><td valign=center > <h2 align='center'> <font COLOR="#CDCDCD" SIZE=5 FACE="sans-serif"> Field Force Automation - Work Order Creation </font></h2></td></tr>
<tr><td align=center>
<table border="0" cellspacing="0" cellpadding="0" width="100%" >
<form name="generatePO" action="./invokeWorkOrderFFA.jsp" onSubmit="return DoTheCheck()">
</tr>
<tr >
<br>
<td width="40%" align="right" > <b> <font color="black" SIZE=2 FACE="sans-serif" align="right"> Interface Type: </font> </b> </td>
<!-- <td width="2%">:</td><td><input type="text" name="SSN" maxlength=10 size=10></td> -->
<td width="60%" colspan = "2">
<SELECT NAME="interfaceType">
<OPTION VALUE="Batch"> Batch </OPTION>
<OPTION VALUE="Near Real Time"> Near Real Time </OPTION>
<OPTION VALUE="Automatic"> Automatic </OPTION>
</SELECT >
</td>
</tr>
<tr>
<td width="40%" align=left>
</td>
<td width="20%" align=left>
</td>
<td width="20%" align=left>
</td>
<td width="20%" align=left>
</td>
</tr>
<tr>
<td width="40%" align=middle><b><font color="black" SIZE=2 FACE="sans-serif" align="right"> Work Order Tasks * : </font> </b></td>
<td width="20%"><b>Maintenance</b><br>
<INPUT TYPE=CHECKBOX NAME="repair" value="repair" >repair<P>
<INPUT TYPE=CHECKBOX NAME="replacement" value="replacement">replacement<P>
</td>
<td width="20%" align=left></td></td>
</tr>
</tr>
<tr> <td width="20%">
<td width="40%" align=left> <b>Emergency</b><br><INPUT TYPE=CHECKBOX NAME="gasEmergency" value="gasEmergency">Gas Emergency<P>
</td>
<td width="20%" align=left>
</td>
<td width="20%" align=left>
</td>
<td width="20%" align=left>
</td>
</tr>
<tr>
<td width="40%" align=middle><b><font color="black" SIZE=2 FACE="sans-serif" align="right"> Additional Information: </font> </b></td>
<td width="20%"><TEXTAREA NAME="additionalInfo" COLS=40 ROWS=6></TEXTAREA>
</td>
<td width="20%" align=left>
</td>
<td width="20%" align=left>
</td>
</tr>
</tr>
<tr bgcolor=#A68064>
<td width="40%" align=left bgcolor=#A68064>
</td>
<td width="20%" align=left bgcolor=#A68064>
</td>
<td width="20%" align=left bgcolor=#A68064>
</td>
<td width="20%" align=left bgcolor=#A68064>
</td>
</tr>
<tr bgcolor=#A68064 ><td width="100%" colspan=4 align=center bgcolor=#A68064>
<input type="submit" name="submit" value="Submit Order" style="background-color: #E9C2A6;">
<input type="reset" name="reset" value="Reset Values" style="background-color: #E9C2A6;" >
<input type="button" name="btn" value=" WO Error Report" onClick="javascript: mypopup()" style="background-color:#E9C2A6;" >
</td>
</tr>
<tr bgcolor=#A68064>
<td width="40%" align=left bgcolor=#A68064>
</td>
<td width="20%" align=left bgcolor=#A68064>
</td>
<td width="20%" align=left bgcolor=#A68064>
</td>
<td width="20%" align=left bgcolor=#A68064>
</td>
</tr>
<tr bgcolor=#A68064>
<td width="50%" colspan = "4" align=left bgcolor="#A68064"> <font color="#CDCDCD"> * Indicates Mandatory fields </font>
</td>
</tr>
<tr bgcolor=#A68064> </tr>
</form>
</table>
</td></tr></table>
</table>
<br>
<!-- <marquee> <b>Wipro Technologies</b>, <br> Disclaimer : This is only a prototype model and used only for testing. </marquee> -->
<script language="JavaScript">
</Script>
</body>
</html>
-----------------createWorkOrderFFA.jsp ends-------------
-----------------invokeWorkOrderFFA.jsp starts-----------
<%@page import="com.oracle.bpel.client.Locator" %>
<%@page import="com.oracle.bpel.client.NormalizedMessage" %>
<%@page import="com.oracle.bpel.client.delivery.IDeliveryService" %>
<html>
<head>
<title>Invoke WorkOrderService </title>
</head>
<body>
<%
String interfaceType = request.getParameter("interfaceType");
String repair = request.getParameter("repair");
System.out.println("repair repair---------------------->");
String replacement = request.getParameter("replacement");
String gasEmergency = request.getParameter("gasEmergency");
String additionalInfo = request.getParameter("additionalInfo");
String woType1="Maintenance";
String woType2="Emergency";
System.out.println("before xml---------------------->");
String xml = "<hostWOApplication xmlns=\"http://services.otn.com\">"
+"<interfaceType>" + interfaceType + "</interfaceType>"
+"<Maintenance>"
+"<repair>" + repair + "</repair>"
+"<replacement>" + replacement + "</replacement>"
+"</Maintenance>"
+"<Emergency>"
+ "<gasEmergency>" + gasEmergency + "</gasEmergency>"
+"</Emergency>"
+ "<additionalInfo>" + additionalInfo + "</additionalInfo>"
+ "</hostWOApplication>";
System.out.println("Payload data ----------------------------------------->"+xml);
Locator locator = new Locator("default","bpel");
System.out.println("Before Idelivery service--------------->");
IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
System.out.println("After IDeliveryService data----------------------->");
// construct the normalized message and send to Oracle BPEL Process Manager
NormalizedMessage nm = new NormalizedMessage( );
nm.addPart("payload", xml );
System.out.println("Before process service--------------->");
deliveryService.request("A2", "process", nm);
System.out.println("After process service--------------->");
out.println( "<b><Font Face=Arial color=red>Work Order has been initiated!</font></b>" );
%>
<table bgColor="#E9C2A6" border="1" cellpadding="0">
<tr ><td width="100%" colspan=4 align=center >
<b>The Work Order Details could be found at this link:
<Font Face=Arial color=red><italic>Work Order Creation Details<italic></Font><b>
</tr>
</table>
</body>
</html>
-----------------invokeWorkOrderFFA.jsp ends-----------
I am getting the following error:
----------------error desc starts----------------------
Oracle BPEL Process Manager Full Cycle
An unexpected error has occurred while executing your request. This is most likely related to a defect in the Oracle BPEL Process Manager product. We apologize for the inconvenience. Please open a TAR in http://metalink.oracle.com if you are our customers. Otherwise, you can post the error to the OTN forum and we will get back to you as soon as possible.
Attachments:
Build Information:
Oracle BPEL Server version 2.2
Build: 1361
Build time: Thu Mar 17 15:51:23 PST 2005
Build type: release
Source tag: BPELPM_10_1_2_beta3_branch
Exception Message:
[java.lang.Exception]
Invalid Login. Domain not specified.
Exception Trace:
java.lang.Exception: Invalid Login. Domain not specified.
at com.collaxa.cube.fe.util.ServletUtils.getLocator(ServletUtils.java:80)
at displayInstance.jspService(_displayInstance.java:71)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at com.collaxa.cube.fe.DomainFilter.doFilter(DomainFilter.java:89)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)
----------------error desc ends----------------------hey mgrovr..
how to ensure that my jsps are under orabpel. i m getting a javax.naming.NameNotFoundException: ejb/collaxa/system/DomainManagerBean not found exception wile invoking bpel process from jsp. I have created the jsps in Jdeveloper and i'm running it from there only.
Can u tell me a way to keep me application under orabpel -
How to use new cluster 'cl' commands from c/c++ code
Hi All
I need to invoke cluster commands from c/c++ code and parse the output to retrieve neccessary fields e.g status to be used in program.
e.g
#cluster status
I need to capture output and use it in c/c++ code.
Does any one have tried to use new cluster 'cl' commands from c/c++ code??
Thanks
PanditThe output of the cl* commands is for human consumption and as such (as most administrative commands) the output is not considered stable, so it could change with a Patch, etc.
Instead you should use the cluster api to retreive the information you need.
The Sun Cluster Data Services Developer's Guide for Solaris OS (http://docs.sun.com/app/docs/doc/819-2972?a=expand) describes the various possibilities, including the C API.
Read especially http://docs.sun.com/app/docs/doc/819-2972/6n57ngitf?a=view for more details as which functions are available via the libdsdev. Each function has a specific manpage outlining the lib and includes needed as well es which information it offers.
In your example, you can use scha_resource_get() (3HA) in order to retrieve the status of a specific resource (http://docs.sun.com/app/docs/doc/819-3055/6n5a6lhnl?a=view).
Greets
Thorsten -
Cannot invoke servlet from JSP
I am trying to invoke a servlet from my JSP file. At present I am getting the error:
500 Internal Server Error
java.lang.IllegalArgumentException: Resource /servlet/CreateSPSS not found
at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindPageContext.forward
I understand that my JSP cannot find my servlet but I cannot identify what the correct path or amendment is.
My JSP file is located in:
default-web-app/examples/jsp/com.xml2spss.jsp
In the JSP my forward parameter is :
<jsp:forward page="/servlet/CreateSPSS" />
and my servlet (.java & .class) is located in
default-web-app/WEB-INF/classes/com/pmstation/spss/site/servlet.CreateSPSS.java
I have added the following line to Web.XML:
<servlet-mapping>
<servlet-name>CreateSPSS</servlet-name>
<url-pattern>/servlet/CreateSPSS</url-pattern>
</servlet-mapping>
Where am I going wrong??
Thankyou for any help at all on this one.Shaun,
Nice to know that you find a way that works. However, what Zsolt suggests should work; otherwise, it is a bug. That is, put the servlet definition and servlet mapping in your web.xml and then you should be able to access http://host:port/myWebContext/servlet/CreateSPSS?myParmName=myParm without seeing a response like "No resource found". Please make sure that your servlet definition come before the corresponding servlet mapping. -
Invoke Java 3d from a JSP?
Hi,
I have a sample java code that invokes a Canvas3d and then invokes a 3D object.
Our project goal is to create an online application-- A JSP page which will invoke the java 3d object.
I am working on Oracle JDeveloper and OC4J server.
Currently , the application runs thru a .java file.
I want to know if it is technically possible to create a jsp page and transfer the 3d object generated by this java file onto the JSP?
I tried renaming the main method of the java file to say testMain (made it static method).
Then thru the JSP , i tried to call this testMain method.
It doesnt work.
thanksHI
I was able to add a canvas3D to a webbrowser via an applet. I suppose you can always invoke an applet from a JSP.
Venkat -
Does anyone know if there is a method for programmatically invoking a webflow from
a jsp? I have a jsp that has multiple "modes", for instance, it posts to itself
and will do one of 3 things "action1", "action2", or "action3".
I want the jsp to mimic a redirect and go to the page associated with action1,
2 or 3.
i saw the method invokePortletWebflow in PortalAppflowHelper but am not sure what
it really does.
thanksHello,
You should use the webflow JSP tag library to create webflow URLs that
will forward the request to. Look at the <webflow:createWebflowURL> tag.
If you want to do a redirect instead of a forward to the destination JSP,
then set doRedirect="true".
What you would do is set event="mystuff.action1" and you would create a
webflow, using the EBCC, that links the "mystuff.action1" event from your
origin JSP to your action1 JSP page. Similarly for action2, action3.
If you are doing this in the context of a portlet that is in a portal,
then you should look at the <portlet:createWebflowURL> tag. Because the
portlet webflow is executed within the overall portal webflow, you must use
this tag to set the portletId and a few other things. You would create a
separate portlet webflow that would be very similar to the webflow I
describe above.
See the webflow taglib docs at
http://edocs.bea.com/wlp/docs70/jsp/navigat.htm#998197
See the portlet taglib docs at
http://edocs.bea.com/wlp/docs70/jsp/mngprtal.htm#1001597
I would also recommend the "Setting Up Portal Navigation" doc at
http://edocs.bea.com/wlp/docs70/dev/navigate.htm
Let me know if you have any trouble creating your webflow and using the
createWebflowURL tag.
"B Hogan" <[email protected]> wrote in message
news:[email protected]..
>
Does anyone know if there is a method for programmatically invoking awebflow from
a jsp? I have a jsp that has multiple "modes", for instance, it posts toitself
and will do one of 3 things "action1", "action2", or "action3".
I want the jsp to mimic a redirect and go to the page associated withaction1,
2 or 3.
i saw the method invokePortletWebflow in PortalAppflowHelper but am notsure what
it really does.
thanks
Maybe you are looking for
-
Ios 7 calendar browsing problem
When searching iOS 7 calendar when i try find some event and click on it calendar sometimes redirect to some other event.
-
Hi All, My customer is wondering that if they raise downpayment invoice and doing out going payment based on Downpayment Invoice. the party ledger is showing zero balance. where they want party ledger to show the downpayment made. So they are opting
-
Hi FI Experts, Could you please suggest me if there is any way we can add Cost center ,WBS and Internal order description fields in transactions FB50,FB60,FBV0,FV50,FV65,FV70,FB70,FV75,FB75. Programatically yes it is possible , we can copy the s
-
Printing "child" names from Address Book on address labels
When I put selected "child" names on Address Books entries and try to print address labels including the kid's names, they don't appear. Example: I add "Jim" as a child name to an Address Book entry for Mike Jones. I try to print the Address Label: M
-
OS User SID ADM profile not loading in Windows 2008
Hi Experts , We have installed Netweaver 7.o EHp1 BI 7.01 on windows 2008, MS SQL 2008 . After few days, we are not able to login with the SIDADM user. The error getting is "User profile cannot be loaded" 'The LoadUserProfile call failed with the fol