Executing Cygwin through JAVA
Hey guys,
I am having a bit of a problem here trying to figure out how to execute cygwin and run cygwin commands through java. So far I have this code below; I ultimately want to make cygwin run an egrep command, but for now I am trying ls -la as a test. I am pretty sure that I need some way of calling the cygwin.bat or bash.exe files, but I am not sure how or where to do this. Thanks for all your input!
try
String cmd = "ls -la";
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd);
proc.waitFor();
BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = "";
while ((line=buf.readLine())!=null) {
System.out.println(line);
catch (Throwable t)
t.printStackTrace();
And what does that code do? Do you have any problems?
Generally, whenever you use exec(), you must read [_When Runtime.exec() won't_|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html] (yes, even f you already read it. Read it again!)
The mistakes explained in there are so common, that the article (all 4 pages of it) should be part of the documentation.
Also: implementing this correctly is possibly more work than re-implementing the feature of egrep that you want. Java has regular expression support and reading text files is not too hard, so it should be quite easy to implement that.
Similar Messages
-
Error while running executable file through java in WinNT
I would like to run an executable file with Java.
- If I try with notepad or paint, i.e. Windows Applications,
I have no problem.
- I also can run Non-Windows-Own Applications, except one.
I get an error message, if I want to run this program through Java.
I have tried following commands to run an executable file.
Runtime.getRuntime().exec("cmd.exe /c "+command);
Runtime.getRuntime().exec("cmd.exe /c start "+command);
Runtime.getRuntime().exec("cmd.exe /c start /wait "+command);
Runtime.getRuntime().exec("cmd.exe /k start "+command);
command : the path to the executable file
I can run the application directly, if I click the icon on desktop,
but not through Java.
here is the error message I get
screenshot : http://www.aykut.de/error_message.jpg
Text : "Security Check failure"
The Logon System has been tampered with.
The Administrator will need to re-install.
my Idea :
The application is "old".
I think it was written for Win 3.1.
Therefore I don't know if there is any other
possibilty to run a "DOS Exe File" through Java.I have just figured out how it works,
if somebody else here in forum have this problem,
here is the solution :
String path = "F:\...\...\Application.exe";
String envDir = path.substring(0, path.lastIndexOf("\\"));
String[] command = {"cmd.exe", "/c", "start", "/wait", "/D"+envDir, path};
Process process = Runtime.getRuntime().exec(command);
"start /Dpath" => path: environment directory F:\...\...\
"start /wait" => wait until Application.exe terminates
if you use Win95 or Win98 use command.com instead of cmd.exe
Aykut -
Problem while executing BAPI_PRODORD_GET_DETAIL through JAVA using JCo
Hi All,
I am trying to get Production Order details in JAVA program using JCo. Following is the code I have written.
JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS);
JCoFunction function = destination.getRepository().getFunction("BAPI_PRODORD_GET_DETAIL");
if(function == null)
throw new RuntimeException("BAPI_PRODORD_GET_DETAIL not found in SAP.");
function.getImportParameterList().setValue("NUMBER", 1067831);
JCoStructure struct = com.sap.conn.jco.JCo.createStructure(destination.getRepository().getStructureDefinition("BAPI_PP_ORDER_OBJECTS"));
struct.setValue("HEADER", 'Y');
struct.setValue("POSITIONS", 'Y');
struct.setValue("SEQUENCES", 'Y');
struct.setValue("OPERATIONS", 'Y');
struct.setValue("COMPONENTS", 'Y');
struct.setValue("PROD_REL_TOOLS", 'Y');
struct.setValue("TRIGGER_POINTS", 'Y');
function.getImportParameterList().setValue("ORDER_OBJECTS", struct);
function.getImportParameterList().setValue("COLLECTIVE_ORDER",'Y');
try
function.execute(destination);
catch(AbapException e)
System.out.println(e.toString());
return;
JCoStructure returnStructure = function.getExportParameterList().getStructure("RETURN");
if (! (returnStructure.getString("TYPE").equals("") ||
returnStructure.getString("TYPE").equals("S") ||
returnStructure.getString("TYPE").equals("W")) )
System.out.println(returnStructure.getString("MESSAGE"));
JCoTable codes = function.getTableParameterList().getTable("HEADER");
int iCnt = codes.getNumRows();
System.out.println("No Of Rows " + iCnt);
int iFldCnt = codes.getNumColumns();
JCoMetaData codesMD = codes.getMetaData();
for (int i = 0; i < codes.getNumRows(); i++)
codes.setRow(i);
// Display the data
The number which I am passing is a valid production order. When I test this BAPI in SAP gui with same input, it gives back the data but when I try to run this through java I always get the return message as this production order does not exist. Is there anything wrong I am doing?
I am using JCo 3.0
I have tried passing various values to ORDER_HEADER structure. I have tried getting the structure from import parameter list and then setting the values on that itself. Nothing has worked for me.
Thanks,
DayanandThe problem is solved. I just set the order number as string and added 0s before the order number to complete the required length. Also I changed the setting import structure for order header. Each field in the structure should have value as 'X' or ' '
JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS);
JCoFunction function = destination.getRepository().getFunction("BAPI_PRODORD_GET_DETAIL");
if(function == null)
throw new RuntimeException("BAPI_PRODORD_GET_DETAIL not found in SAP.");
function.getImportParameterList().setValue("NUMBER", "000001067831");
JCoStructure struct = com.sap.conn.jco.JCo.createStructure(destination.getRepository().getStructureDefinition("BAPI_PP_ORDER_OBJECTS"));
struct.setValue("HEADER", 'X');
struct.setValue("POSITIONS", 'X');
struct.setValue("SEQUENCES", 'X');
struct.setValue("OPERATIONS", 'X');
struct.setValue("COMPONENTS", 'X');
struct.setValue("PROD_REL_TOOLS", 'X');
struct.setValue("TRIGGER_POINTS", 'X');
function.getImportParameterList().setValue("ORDER_OBJECTS", struct);
function.getImportParameterList().setValue("COLLECTIVE_ORDER",'X');
try
function.execute(destination);
catch(AbapException e)
System.out.println(e.toString());
return;
JCoStructure returnStructure = function.getExportParameterList().getStructure("RETURN");
if (! (returnStructure.getString("TYPE").equals("") ||
returnStructure.getString("TYPE").equals("S") ||
returnStructure.getString("TYPE").equals("W")) )
System.out.println(returnStructure.getString("MESSAGE"));
JCoTable codes = function.getTableParameterList().getTable("HEADER");
int iCnt = codes.getNumRows();
System.out.println("No Of Rows " + iCnt);
int iFldCnt = codes.getNumColumns();
JCoMetaData codesMD = codes.getMetaData();
for (int i = 0; i < codes.getNumRows(); i++)
codes.setRow(i);
// Display the data
Regards,
Dayanand -
How to execute vbscript through java
hi i m trying to run vbscript (that accept some command line arguments) through java .
my vbs file is stored in c: drive
purpose of vbs file : to map network drives.
i normally run it from command prompt using following syntax
c:\cscript map.vbs l: \\10.22.122.35\d$ <username> <password>
code in map.vbs
map.vbs
Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strLocalDrive = WScript.Arguments.Item(0)
strRemoteShare = WScript.Arguments.Item(1)
strPer = "FALSE"
strUsr = WScript.Arguments.Item(2)
strPas = WScript.Arguments.Item(3)
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
my problem is i can easily accomplish this by using .batch file but i dont want to reveal my username and password
i just want to know is there any way thru which i can somehow link java program with dos command and execute vbs file
from my java program.
the code that i have got is not working properly or has to be modified to work.
String os = System.getProperty("os.name").toLowerCase();
if (os.indexOf("windows") != -1)
String[] command = new String[]{"cmd.exe", "/c","cscript","c:\\map.vbs", '"'+strDrive+'"','"'+strPath+'"',"<username>" ,"<password>"};
Runtime.getRuntime().exec(command);
Kindly help me as this is very urgent.prompt for the login, the password, and the new share name, and store them in variables, then, you can do something like:
Runtime.getRuntime().exec("net use " + sharenameVar + " \\\\HOST\\share /user:HOST\\" + userVar + " \"" + passwordVar + "\"");with the following values:
HOST: PC10
user : toto
pass : a password
sharename: I:
it will result in :
net use I: \\PC10\share /user:PC10\toto "a password"
this will map the new share with the given credentials ; there is no need to add some complexity by using a vbscript to do that -
Error while executing SQL through Java snippet in ADF
Hi,
I am taking inputs taken from user using ADF UI and storing this input data in XML File.With this Input.xml, I build a sql Query and execute using java program within the same ADF application.
I am getting following error:
java.sql.SQLException: SQL string is not Query
If I run the Java program with the same Input.xml separately, it doesnot error out.
Any help would be great
Thanks
SushamaHi Sushama,
We require more information to provide you with a more accurate solution:
1- Do you have a business method (on your Application Module or Session Bean) where you create the query? Can you try to test this method on a TestClient java class or AM Tester if applicable and validate the method works without a problem.
2-On your viewController project set the following argument to your run setting -Djbo.debugoutput=console. This in order to check what kind of SQL statement is being generated.
For more information on debugging please go to: http://www.oracle.com/technology/products/jdev/tips/muench/debugger/index.html
-Juan Camilo -
How can i execute a .jar or .jad through java?
I want to execute a .jar like i do in SE using the class RunTime in ME does anybody know how can i do it? There is no method exec in MIDP Runtime API
I have a MIDlet that receives a jar file from another PDA using DatragramConection and FileConnection. It's working well. When i'm running my application i'll send the jar file to another aplication and this application should receive, execute and return the result. For example, if i have a simple program that prints Hello World. I'll send the program the other PDA will execute and then return a String. I have to call the jr file through java because my MIDlet wil be already running.
Could you understand my problem? -
Problem in executing a unix command through java
hi
i'm trying to execute unix command through java
simple shell command like "ls -l >test " but i'm not able to see the result.
there are no error messages.
Code is:
import java.lang.Runtime.*;
class ExecDemo
public static void main(String[] args)
Runtime r=Runtime.getRuntime();
Process p=null;
try
p=r.exec("ls -l > test");
catch (Exception e)
System.out.println("Error executing nedit.");
}can anyone help please.get the the inputStream of the runtime object after executing the command.
now use the readLine() function until it becomes null.
egs: with reference to ur code.
InputStream is=p.getInputStream()
while(is!=null)
String s=is.readLine();
if the command don't execute try giving the full path also like /sbin/ls -l -
Executing the top command through Java in linux
I am trying to execute the top command in Java as
Runtime.getRuntime().exec("top -n 1 >a.log");
But the command is not working in linux only through java.When i run the same command through the prompt it is working fine.Also all other commands are working fine.Is there any issue with top in linux?flounder wrote:
Try reading [this article|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html]. If it does not answer your problem then try seaching for other similar articles.
The cited article does provide an answer to the problem since it explains how the shell meta character '>' must be interpretted by a shell. The code as presented does not invoke a shell. -
Problem with executing shell script on linux through java code.
i am facing problem to kill jboss process on linux that is my application requirement. for that i created one shell script that will get all the process for jboss instance and kill them when i am running that script from command prompt on linux its working perfectly.
The command i am using ---
/opt/RW9/jboss/v4.0.5.GA/bin/restartjboss.sh.
but when i am running through java code its not working.
the java code i am using is:-
pp = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", "/opt/RW9/jboss/v4.0.5.GA/bin/restartjboss.sh"});
could anyone tell me what is the problem ?
Edited by: akm198110 on Sep 2, 2008 9:24 AMI got the problem after long struggle ,after doing proper path i am able to execute the shell script..
-
Execute dos commands through java
Hi,
Im trying to execute dos commands through java like
try {
java.lang.Runtime.getRuntime().exec("cmd /c cls");
}catch(IOException e){
System.out.println(e.getMessage());
}Not sure if its possible? however
open notepad would work
try {
java.lang.Runtime.getRuntime().exec("notepad");
}catch(IOException e){
System.out.println(e.getMessage());
}Im trying to execute a cls commands to clear screen but without luck.The question is, which shell do you want to clear?
I don't really know, but it could be that Runtime.exec executes its command in a new shell window... -
Hot to call forms11g fmx file through Java executable
Hi,
Iam having one file in some folder which will come through FTP , whenever file comes to the folder i should call the some form fmx file through JAVA so that my form will take care rest of the things .
My question is how to call fmx through Java executable in windows environment.
thanks in advance
GVHi All,
Thnaks for the Info. But my requirement is different.
1) whenever i received a file through FTP from other server to my server , some folder say d:\Test
a) some batch program has to trigger and first it should take the backup of the received file to some other folder say d:\archive
b) some batch program has to trigger to call the forms fmx file so that form will take care of reading from the file and put the data to database for the received file in d:\Test.
Assume that it is in windows environment/Linux Environment . How i can achieve these tasks. There should not any user intervention in this , everything is automatic.
Please guide me any solutions
Thanks in advance
GV -
Need Help-How Store the input parameter through java bean
Hello Sir,
I have a simple Issue but It is not resolve by me i.e input parameter
are not store in Ms-Access.
I store the input parameter through Standard Action <jsp:useBean>.
jsp:useBean call a property IssueData. this property exist in
SimpleBean which create a connection from DB and insert the data.
At run time servlet and server also show that loggging are saved in DB.
But when I open the table in Access. Its empty.
Ms-Access have two fields- User, Password both are text type.
Please review these code:
login.html:
<html>
<head>
<title>A simple JSP application</title>
<head>
<body>
<form method="get" action="tmp" >
Name: <input type="text" name="user">
Password: <input type="password" name="pass">
<input type="Submit" value="Submit">
</form>
</body>
</html>LoginServlet.java:
import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException{
try
String user=request.getParameter("user");
String pass=request.getParameter("pass");
co.SimpleBean st = new co.SimpleBean();
st.setUserName(user);
st.setPassword(pass);
request.setAttribute("user",st);
request.setAttribute("pass",st);
RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
dispatcher1.forward(request,response);
catch(Exception e)
e.printStackTrace();
}SimpleBean.java:
package co;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class SimpleBean {
private String user="";
private String pass="";
private String s="";
public String getUserName() {
return user;
public void setUserName(String user) {
this.user = user;
public String getPassword() {
return pass;
public void setPassword(String pass) {
this.pass = pass;
public String getIssueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getUserName();
getPassword();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Loading....");
Connection con=DriverManager.getConnection("jdbc:odbc:simple");
System.out.println("Connected....");
PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String User=getUserName();
st.setString(1,User);
String Password=getPassword();
st.setString(2,Password);
st.executeUpdate();
System.out.println("Query Executed");
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
}submit.jsp:
This is Submit page
<html><body>
Hello
Student Name: <%= ((co.SimpleBean)request.getAttribute("user")).getUserName() %>
<br>
Password: <%= ((co.SimpleBean)request.getAttribute("pass")).getPassword() %>
<br>
<jsp:useBean id="st" class="co.SimpleBean" scope="request" />
<jsp:getProperty name="st" property="IssueData" />
</body></html>web.xml:<web-app>
<servlet>
<servlet-name>one</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>one</servlet-name>
<url-pattern>/tmp</url-pattern>
</servlet-mapping>
<jsp-file>issue.jsp</jsp-file>
<jsp-file>submit.jsp</jsp-file>
<url-pattern>*.do</url-pattern>
<welcome-file-list>
<welcome-file>Login.html</welcome-file>
</welcome-file-list>
</web-app>Please Help me..Thanks.!!!
--Dear Sir,
Same issue is still persist. Input parameter are not store in database.
After follow your suggestion when I run this program browser show that:i.e
This is Submit page Hello Student Name: vijay
Password: kumar
<jsp:setProperty name="st" property="userName" value="userValue/> Your logging is saved in DB
Please review my code.
login.html:
{code}<html>
<head>
<title>A simple JSP application</title>
<head>
<body>
<form method="get" action="tmp" >
Name: <input type="text" name="user">
Password: <input type="password" name="pass">
<input type="Submit" value="Submit">
</form>
</body>
</html>{code}
LoginServlet.java:
{code}import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException{
try
String userValue=request.getParameter("user");
String passValue=request.getParameter("pass");
co.SimpleBean st = new co.SimpleBean();
st.setuserName(userValue);
st.setpassword(passValue);
request.setAttribute("userValue",st);
request.setAttribute("passValue",st);
RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
dispatcher1.forward(request,response);
catch(Exception e)
e.printStackTrace();
}{code}
SimpleBean.java:
{code}package co;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class SimpleBean {
private String userValue="";
private String passValue="";
private String s="";
public String getuserName() {
return userValue;
public void setuserName(String userValue) {
this.userValue = userValue;
public String getpassword() {
return passValue;
public void setpassword(String passValue) {
this.passValue= passValue ;
public String getissueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getuserName();
getpassword();
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Connection loaded");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
System.out.println("Connection created");
PreparedStatement st=con.prepareStatement("insert into vij values(?,?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String userName=getuserName();
st.setString(1,userName);
String password=getpassword();
st.setString(2,password);
st.executeUpdate();
System.out.println("Query Executed");
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
}{code}
submit.jsp:
{code}This is Submit page
<html><body>
Hello
Student Name: <%= ((co.SimpleBean)request.getAttribute("userValue")).getuserName() %>
<br>
Password: <%= ((co.SimpleBean)request.getAttribute("passValue")).getpassword() %>
<br>
<jsp:useBean id="st" class="co.SimpleBean" scope="request" />
<jsp:setProperty name="st" property="userName" value="userValue/>
<jsp:setProperty name="st" property="password" value="passValue"/>
<jsp:getProperty name="st" property="issueData" />
</body></html>web.xml:<web-app>
<servlet>
<servlet-name>one</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>one</servlet-name>
<url-pattern>/tmp</url-pattern>
</servlet-mapping>
<jsp-file>submit.jsp</jsp-file>
<url-pattern>*.do</url-pattern>
<welcome-file-list>
<welcome-file>Login.html</welcome-file>
</welcome-file-list>
</web-app>Sir I can't use EL code in jsp because I use weblogic 8.1 Application Server.This version are not supported to EL.
Please help me...How store th input parameter in Database through Java Bean -
Error while trying to access BPEL process through java on localhost
I have a service (CreditRatingService that comes along with install) running on the BPEL engine. Trying to invoke it through java. However, I get an exception. Below is more information. Appreciate any help.
My method
public String invokeBpel()
Map payload;
Hashtable jndi = null;
try
String ssn ="1234";
String xml = "<ssn xmlns=\"http://services.otn.com\">" + ssn + "</ssn>";
Locator locator;
locator = new Locator("default","welcome1",jndi);
IDeliveryService deliveryService =
(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
NormalizedMessage nm = new NormalizedMessage( );
nm.addPart("payload", xml );
NormalizedMessage res =null;
try
res = deliveryService.request("CreditRatingService","process", nm);
catch(RemoteException oNameEx)
System.out.println(oNameEx.getMessage());
payload = res.getPayload();
System.out.println( "BPELProcess CreditRatingService executed!<br>" );
System.out.println( "Credit Rating is " + payload.get("payload") );
catch (Exception e)
System.out.println("This is the exception" + e);
System.out.println(e.getStackTrace());
finally
return "toPage3";
}//end method
Exception text
Failed to create "ejb/collaxa/system/DeliveryBean" bean; exception reported "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found
Env
ADF Business Components:10.1.3.39.84
BPEL Designer 10.1.3.1.0 (Build 061009.0802)
CVS Version Internal to Oracle JDeveloper (client-only)
Java™ Platform 1.5.0_06
Oracle IDE 10.1.3.39.84
Struts Modeler Version 10.1.3.39.84
UML Modelers Version 10.1.3.39.84
Versioning Support 10.1.3.39.84Hashtable jndi = null;
try
String ssn ="1234";
String xml = "<ssn xmlns=\"http://services.otn.com\">" + ssn + "</ssn>";
Locator locator;
locator = new Locator("default","welcome1",jndi);
this implies to be in the same initial context then the bpel engine, whicuh you cannot be as long as you are not either part of the ejb code of orabpel or a child of it. and if you are you can use the Locator API without the jndi properties.
hth clemens -
Running windows command through java code
Hello
i want to execute jar.exe through java code , i have written following piece of code , but it isn't working
ProcessBuilder processBuilder = new ProcessBuilder(new String[]{"cmd.exe","/c","%java_home%\\bin\\jar.exe"});
Process process = processBuilder.start();
BufferedReader inputReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
String line = inputReader.readLine();
while(line != null){
System.out.println(line);
line = inputReader.readLine();
does anybody knows why
Regards
Edited by: Mayur Mitkari on Mar 5, 2013 10:19 PM
Edited by: Mayur Mitkari on Mar 5, 2013 10:20 PM
Edited by: Mayur Mitkari on Mar 5, 2013 10:20 PMsorry for that , but the
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec(new String[]{"cmd.exe","/c","jar"});
proc.waitFor();
int i = proc.exitValue();
this code was different from first one
and in case of Process if runtime .exec is succesful it is wainting for long time , in this case i want if the runtime.exec is succesful something should be returned
Regards -
Unable to checkin a document using 'CHECKIN_UNIVERSAL" service through java
Hi All,
I am trying to checkin a document through java code and following is my code part for the same( UCM 11g)
But whenever i run this code part, it throws the following exception
intradoc.common.ServiceException:csUnableToCheckin,<null>!csUnabletoExecMethod,populateMissingDocumentValues
Can anyone help me with this?
Code part
private void checkinDoc()
File f=new File("D:/testfolder/BPEL.pdf");
System.out.println(" absolute path :"+f.getAbsolutePath());
String filePath = f.getAbsolutePath().replace("\\", "/");
checkedOutDataBinder.putLocal("IdcService", "CHECKIN_UNIVERSAL");
checkedOutDataBinder.putLocal("dDocTitle","test");
checkedOutDataBinder.putLocal("dDocAuthor", "weblogic");
checkedOutDataBinder.putLocal("dDocType","Document");
checkedOutDataBinder.putLocal("dSecurityGroup","public");
checkedOutDataBinder.putLocal("doFileCopy", "1");
checkedOutDataBinder.putLocal("primaryFile", filePath);
checkedOutDataBinder.putLocal("xCollectionID", "425180507509000004");
checkedOutDataBinder = executeService(checkedOutDataBinder,
"weblogic");
private DataBinder executeService(final DataBinder binder,
final String userName) throws DataException, ServiceException
// obtain a connection to the database
Workspace workspace = getSystemWorkspace();
// check for an IdcService value
String cmd = binder.getLocal("IdcService");
if (cmd == null)
throw new DataException("!csIdcServiceMissing");
// obtain the service definition
ServiceData serviceData = ServiceManager.getFullService(cmd);
if (serviceData == null)
throw new DataException(LocaleUtils.encodeMessage(
"!csNoServiceDefined", null, cmd));
// create the service object for this service
Service service = ServiceManager.createService(serviceData.m_classID,
workspace, null, binder, serviceData);
// obtain the full user data for this user
UserData fullUserData = getFullUserData(userName, service, workspace);
service.setUserData(fullUserData);
// binder.m_environment.put(REMOTE_USER, userName);
ServiceException error = null;
try
// init the service to not send HTML back
service.setSendFlags(true, true);
// create all the ServiceHandlers and implementors
service.initDelegatedObjects();
// do a security check
service.globalSecurityCheck();
// prepare for the service
service.preActions();
// execute the service
service.doActions();
// do any cleanup
service.postActions();
// store any new personalization data
// service.updateSubjectInformation(true);
//service.updateTopicInformation(binder);
catch (ServiceException e)
error = e;
e.printStackTrace();
finally
// Remove all the temp files.
service.cleanUp(true);
workspace.releaseConnection();
// handle any error
if (error != null)
// throw new ServiceException(error.m_errorCode, error
// .getMessage());
return binder;
}I have been running into the same exception, albeit with UCM 10g:
Content item 'xxx' was not successfully checked in. Unable to execute service method 'populateMissingDocumentValues'. (System Error: Runtime error: java.lang.NullPointerException
at collections.CollectionMetaHandler.validateMetaDataDates(CollectionMetaHandler.java:771)
at collections.CollectionMetaHandler.fillInUndefinedMeta(CollectionMetaHandler.java:806)
at collections.CollectionUserHandler.setUndefinedMetaData(CollectionUserHandler.java:1353)
at collections.CollectionUserHandler.populateMissingDocumentValues(CollectionUserHandler.java:1275)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at intradoc.common.IdcMethodHolder.invokeMethod(ClassHelperUtils.java:617)
at intradoc.common.ClassHelperUtils.executeMethodReportStatus(ClassHelperUtils.java:293)
at intradoc.server.ServiceHandler.executeAction(ServiceHandler.java:79)
at intradoc.server.Service.doCodeEx(Service.java:490)
at intradoc.server.Service.doCode(Service.java:472)
at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1360)
at intradoc.server.Service.doAction(Service.java:452)
at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1201)
at intradoc.server.Service.doActions(Service.java:447)
it seems to have something to do with the xCollectionID.
If I don't set this, it works fine (checking in and out, checking in new revision). If I set it I can check in a new item using CHECKIN_NEW but I am unable to use CHECKIN_UNIVERSAL to check in a new revision.
Any pointers would be appreciated.
Edited by: Jaap on 6-jun-2011 2:41
Edited by: Jaap on 6-jun-2011 3:09
Maybe you are looking for
-
Problems with new airport extreme
i'm a network admin who has dealt with seemingly every network problem imaginable over the last 15 years, but this one has me stumped. really hoping someone can help me see the forest for the trees on this one. the problem started last week when i d
-
Error occured in the integration checks(read log)
Hi, I try to post planning of machinery hours in KP26, tht time i got this error, and data is not saved too. " error occured in the integration checks(read log)" kindly solve this problem asap. Regards PRINCE
-
Install Web Dispatcher in a Windows Cluster
Hello all, is it possible to define an installed WebDispatcher Service. I didn't find any hints in SAP notes. Thnaks for your help. Regards Franz-Josef
-
Need help with Rollback data if there is error in Data load
Hi All, We are trying to load data to Oracle 11g database. We want a trigger, procedure or something like that to rollback the data if there are errors in load. Is it possible to do rollback after all the records has been parsed ? So if we try to loa
-
File read/write in separate threads
If I have a file in process of being written out, and another thread comes along to read it, will it block until the first thread closes the file, or do I have to handle that programatically?