Parsing file inputs
I am trying to extract the information in the following from the right side of the equal sign into a string object (sVal_...).
[VisQServer]
Resubmit=N
User=221a1c231c043a
Client=260a1c30475163
FTPUsername=221a1c231c043a
Jobname=asf
ClientFile=E:\QMan\build\.cmake.state
ServerFile=D:\scratch\tsorial\.cmake.state
Command=1
CommandOpt=
Priority=2
Retrieve=N
Delete=N
Compress=N
Here is my code:
// Read Job File and extract info into a string object
Properties p=new Properties();
p.load( new FileInputStream( sJobFileName ) );
sVal_user=p.getProperty(USERNAME);
sVal_client=p.getProperty(CLIENT);
sVal_jobname=p.getProperty(JOBNAME);
sVal_resubmit=p.getProperty(RESUBMIT);
sVal_priority=p.getProperty(PRIORITY);
sVal_clientfile=p.getProperty(CLIENTFILE);
sVal_serverfile=p.getProperty(SERVERFILE);
sVal_commandopt=p.getProperty(COMMANDOPT);
sVal_command=p.getProperty(COMMAND);
sVal_ftpusername=p.getProperty(FTPUSERNAME);
sVal_retrieve=p.getProperty(RETRIEVE);
sVal_delete=p.getProperty(DELETE);
sVal_compress=p.getProperty(COMPRESS);Somehow when the 'ClientFile' argument gets extracted the result is E:QManbuild.cmake.state not E:\QMan\build\.cmake.state; same goes for serverfile. Why are the slash character being removed and how can I correct this. Your help is greatly appreciated.
It really shouldn't be that bad....I haven't proofread it or compiled it, but this class should do the job (at least, you'll get the idea). My only stipulation is that you have to name your class DilbertProperties to so that your boss will get the idea...:)
class DilbertProperties extends HashMap
public DilbertProperties(File file)
BufferedReader read = new BufferedReader(new FileReader(sJobFileName));
String temp = null;
while( (temp = read.readLine()) != null)
StringTokenizer st = new StringTokenizer(temp, "=");
if(st.countTokens() == 2)
String key = st.nextToken();
String value = st.nextToken();
// put this key, value pair into the HashMap
this.put(key, value);
// use this method to retrieve a property
public String getProperty(String key)
return (String)this.get(key);
}
Similar Messages
-
Getting parameters from text and file input tag. . canyou help me ?
Hello!
Is there anyway of getting parameters from an
text field input in a form like :
<form name="signinForm" method="post" action="uploadFile.jsp" enctype="multipart/form-data" >Actually I would like to insert the parameters and make the upload of an file
on the same form. It is something likethis :
Form.jsp
<form name="signinForm" method="post" action="uploadFile.jsp" enctype="multipart/form-data" >
<input type="text" id="name" name="signinName" />
<input name="signinFile" id="fileUp" type="file" />
<input type="submit" id="submit_btn" name="signinSubmit"/>uploadingFile.jsp
<%@ page import="java.io.*,javax.servlet.http.HttpServletRequest,javax.servlet.ServletInputStream" %>
<%@ page import="java.io.FileWriter,java.io.IOException" %>
<%
.//upload the file
String email = request.getParameter("signinName").trim(); //this line is bringing me an NullPointerException
%>Thanks in advance for any suggestion!!
All the best!You cannot use the HttpServletRequest object to retrieve parameters from a multipart form. You'll have to use a package that can parse such a form. I suggest Apache commons FileUpload.
http://jakarta.apache.org/commons/fileupload/
Using this package you can get both the file upload and any other parameters. -
Passing request of file input type to a jsp
Hi i m using this script for file uploading the form is.... <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form action="uploadscript.jsp" name="filesForm" enctype="multipart/form-data" method="post">
Please specify a file, or a set of files:
<input type="file" name="userfile_parent" value="userfile_parent" >
<input type="submit" value="submit" value="Send">
</form> </body> </html> And i am tring to get the url on uploadscript.jsp by using String parentPath=request.getParameter("userfile_parent"); but i foud that its value is NULL it is not working what should i do to get the userfile_parent on uploadscript.jsp help me!!! Message was edited by: UDAY Message was edited by: UDAY
avajain
Posts: 135
From: Noida , India
Registered: 5/10/06
Read Re: Passing response but getting NULL
Posted: Sep 20, 2006 2:43 AM in response to: UDAY in response to: UDAY
Click to reply to this thread Reply
Use method="GET" in place of method="post" .
Thanks
UDAY
Posts: 26
From: JAIPUR
Registered: 8/14/06
Read Re: Passing response but getting NULL
Posted: Sep 20, 2006 3:18 AM in response to: avajain in response to: avajain
Click to edit this message... Click to reply to this thread Reply
now it is giving this error message by e.getMessage()
[br]the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null
the uploadscript is this....
http://www.one.esmartstudent.com
can u please help me.Here is sample code which we have used in one of our projects with org.apache.commons.fileupload.*.
You can find String fullName = (String) formValues.get("FULLNAMES"); at the end that gives name of file.
<%@ page import="java.util.*"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="java.io.File"%>
<%@ page import="java.io.*"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page import="org.apache.commons.fileupload.disk.*"%>
<%@ page import="org.apache.commons.fileupload.servlet.*"%>
<%!
//method to return file extension
String getFileExt(String xPath){
//Find extension
int dotindex = 0; //extension character position
dotindex = xPath.lastIndexOf('.');
if (dotindex == -1){ // no extension
return "";
int slashindex = 0; //seperator character position
slashindex = Math.max(xPath.lastIndexOf('/'),xPath.lastIndexOf('\\'));
if (slashindex == -1){ // no seperator characters in string
return xPath.substring(dotindex);
if (dotindex < slashindex){ //check last "." character is not before last seperator
return "";
return xPath.substring(dotindex);
%>
<%
Map formValues = new HashMap();
String fileName = "";
boolean uploaded = false;
// Check that we have a file upload request
boolean isMultipart = FileUpload.isMultipartContent(request);
//Create variables for path, filename and extension
String newFilePath = CoeResourceBundle.getEmailProperties("FILE_UPLOAD_PATH");//application.getRealPath("/")+"temp";
String newFileName ="";
String FileExt = "";
//System.out.println(" newFilePath"+newFilePath+"/");
//out.println(" newFilePath"+newFilePath+"<br>");
// Create a factory for disk-based file items
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// Parse the request
List /* FileItem */ items = upload.parseRequest(request);
// System.out.println(" newFilePath"+newFilePath+"/");
// Process the uploaded items
Iterator iter = items.iterator();
//Form fields
while (iter.hasNext()) {
//System.out.println("in iterator");
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
String name = item.getFieldName();
String value = item.getString();
if (name.equals("newFileName")) {
newFileName = value;
//System.out.println("LOADING");
formValues.put(name,value);
else {
//System.out.println("in iterator----");
String fieldName = item.getFieldName();
fileName = item.getName();
int index = fileName.lastIndexOf("\\");
if(index != -1)
fileName = fileName.substring(index + 1);
else
fileName = fileName;
FileExt = getFileExt(fileName);
String contentType = item.getContentType();
boolean isInMemory = item.isInMemory();
long sizeInBytes = item.getSize();
if (fileName.equals("") || sizeInBytes==0){
out.println("Not a valid file.<br>No upload attempted.<br><br>");
} else {
// out.println("ACTUAL fileName= " newFilePath"\\"+fileName+ "<br>");
//File uploadedFile = new File(newFilePath+"\\", newFileName+FileExt);
File uploadedFile = new File(newFilePath+"/",fileName);
File oldFile = new File(CoeResourceBundle.getEmailProperties("FILE_UPLOAD_PATH")+"/"+fileName);
File oldFileApproved = new File(CoeResourceBundle.getEmailProperties("APPROVED_FILE_LOCATION")+"/"+fileName);
try{
if (!oldFile.exists()&&!oldFileApproved.exists())
item.write(uploadedFile);
uploaded = true;
//out.println(fileName+" was successfully uploaded as "+ newFileName+FileExt +".<br><br>");
catch (java.lang.Exception e) {
out.println("Errors prevented the file upload.<br>"+fileName+ " was not uploaded.<br><br>");
String userid = (String) formValues.get("USERID");
String fullName = (String) formValues.get("FULLNAMES");
String email = (String) formValues.get("EMAILID");
String empno = (String) formValues.get("EMPNO");
String docType = (String) formValues.get("DOCTYPE");
String desc = (String) formValues.get("MYTEXT");
String title = (String) formValues.get("TITLEBOX");
String module = (String) formValues.get("MODULE");
String techfunctype = (String) formValues.get("TECHFUNCTYPE");
%> -
[IWAF JCA PeopleSoft] **** Error in parsing the input document.
Hi,
I configured Peoplesoft Adapter 10.1.3.1 with Oracle BPEL 10.1.3.1, I am able to invoke BPEL from Peoplesoft using JCA configurtaion. But I am not able to invoke Peoplesoft component interface from BPEL PM, Invoke call fails with following error. Did any one know solution to this issue.
Thanks,
Manish
Tue, 6 Nov 2007 16:40:20.0954 IST - Thread[AJPRequestHandler-HTTPThreadGroup-56,5,HTTPThreadGroup] [info ] [IWAF JCA PeopleSoft] IWAFManagedConnection for PeopleSoft:Peoplesoft has listener registered: com.evermind.server.connector.ConnectionContext@b78555
Tue, 6 Nov 2007 16:40:21.0204 IST - Thread[AJPRequestHandler-HTTPThreadGroup-56,5,HTTPThreadGroup] [info ] [IWAF JCA PeopleSoft] Local transaction not supported by underlying adapter.
Tue, 6 Nov 2007 16:40:21.0204 IST - Thread[AJPRequestHandler-HTTPThreadGroup-56,5,HTTPThreadGroup] [info ] [IWAF JCA PeopleSoft] IWAFManagedConnection for PeopleSoft:Peoplesoft dispatch event 2
Tue, 6 Nov 2007 16:40:21.0204 IST - Thread[AJPRequestHandler-HTTPThreadGroup-56,5,HTTPThreadGroup] [error] [IWAF JCA PeopleSoft] **** Error in parsing the input document.
oracle.xml.parser.v2.XMLParseException: Start of root element expected.
at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:320)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:341)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:205)
at com.iwaysoftware.idom.XmlDocument.parse(XmlDocument.java:120)
at com.iwaysoftware.idom.XmlDocument.setRootXML(XmlDocument.java:77)
at com.ibi.afjca.cci.IWAFInteraction.execProcess(IWAFInteraction.java:195)
at com.ibi.afjca.cci.IWAFInteraction.exec(IWAFInteraction.java:136)
at com.ibi.afjca.cci.IWAFInteraction.execute(IWAFInteraction.java:93)
at oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeRequestResponseOperation(WSIFOperation_JCA.java:470)
at com.collaxa.cube.ws.WSIFInvocationHandler.invoke(WSIFInvocationHandler.java:431)
at com.collaxa.cube.ws.WSInvocationManager.invoke2(WSInvocationManager.java:416)
at com.collaxa.cube.ws.WSInvocationManager.invoke(WSInvocationManager.java:222)
at com.collaxa.cube.engine.ext.wmp.BPELInvokeWMP.__invoke(BPELInvokeWMP.java:736)
at com.collaxa.cube.engine.ext.wmp.BPELInvokeWMP.__executeStatements(BPELInvokeWMP.java:371)
at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perform(BPELActivityWMP.java:195)
at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:3271)
at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1697)
at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:75)
at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:184)
at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:269)
at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:5244)
at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:1083)
at com.collaxa.cube.engine.ejb.impl.CubeEngineBean.createAndInvoke(CubeEngineBean.java:132)
at com.collaxa.cube.engine.ejb.impl.CubeEngineBean.syncCreateAndInvoke(CubeEngineBean.java:161)
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 com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:31)
at com.evermind.server.ThreadState.runAs(ThreadState.java:620)
at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:34)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.TxRequiresNewInterceptor.invoke(TxRequiresNewInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
at CubeEngineBean_LocalProxy_4bin6i8.syncCreateAndInvoke(Unknown Source)
at com.collaxa.cube.engine.delivery.DeliveryHandler.initialRequestAnyType(DeliveryHandler.java:499)
at com.collaxa.cube.engine.delivery.DeliveryHandler.initialRequest(DeliveryHandler.java:451)
at com.collaxa.cube.engine.delivery.DeliveryHandler.request(DeliveryHandler.java:125)
at com.collaxa.cube.ejb.impl.DeliveryBean.request(DeliveryBean.java:95)
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 com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:31)
at com.evermind.server.ThreadState.runAs(ThreadState.java:620)
at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:34)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
at DeliveryBean_RemoteProxy_4bin6i8.request(Unknown Source)
at com.collaxa.cube.ws.soap.oc4j.SOAPRequestProvider.processNormalOperation(SOAPRequestProvider.java:455)
at com.collaxa.cube.ws.soap.oc4j.SOAPRequestProvider.processBPELMessage(SOAPRequestProvider.java:278)
at com.collaxa.cube.ws.soap.oc4j.SOAPRequestProvider.processMessage(SOAPRequestProvider.java:129)
at oracle.j2ee.ws.server.provider.ProviderProcessor.doEndpointProcessing(ProviderProcessor.java:869)
at oracle.j2ee.ws.server.WebServiceProcessor.invokeEndpointImplementation(WebServiceProcessor.java:349)
at oracle.j2ee.ws.server.provider.ProviderProcessor.doRequestProcessing(ProviderProcessor.java:460)
at oracle.j2ee.ws.server.WebServiceProcessor.processRequest(WebServiceProcessor.java:114)
at oracle.j2ee.ws.server.WebServiceProcessor.doService(WebServiceProcessor.java:96)
at oracle.j2ee.ws.server.WebServiceServlet.doPost(WebServiceServlet.java:177)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:410)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
Tue, 6 Nov 2007 16:40:21.0204 IST - Thread[AJPRequestHandler-HTTPThreadGroup-56,5,HTTPThreadGroup] [error] [IWAF JCA PeopleSoft] SOS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Tue, 6 Nov 2007 16:40:21.0204 IST - Thread[AJPRequestHandler-HTTPThreadGroup-56,5,HTTPThreadGroup] [error] [IWAF JCA PeopleSoft] oracle.xml.parser.v2.XMLElement@1f73ac7
Tue, 6 Nov 2007 16:40:21.0204 IST - Thread[AJPRequestHandler-HTTPThreadGroup-56,5,HTTPThreadGroup] [error] [IWAF JCA PeopleSoft] EOS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Tue, 6 Nov 2007 16:40:21.0204 IST - Thread[AJPRequestHandler-HTTPThreadGroup-56,5,HTTPThreadGroup] [info ] [IWAF JCA PeopleSoft] IWAFManagedConnection for PeopleSoft:Peoplesoft dispatch event 4Kris,
I tried your suggestion, but it didn't help. I think the Ci jar file is getting loaded, because when I try to call any other interface whos class files are not included in CI jar file, it gives different error like "Not Authorized (90,6)Failed to execute PSSession request Cannot find Component Interface {LACATION_TABLE} (91,2)".
We verified all the configuration on Adapter and Peoplesoft aerver, every thing seems to be absolutely fine, even I turned on debug log level for adapter but that is not of any use.
I tried searching on the google, it seems many people who used Component Interface Java Classes faced such type of problem, they recommended some peoplesoft configuration, I tried their suggestions as well, but that also didn't work out.
Even though we are using Peoplesoft 8.4 Adapter asks for pstools.properties file whenever the BPEL Process is invoked, this file is there in the adapters lib directory, and jca-app-adapter directory, see below the log.
<2007-11-26 18:33:17,656> <INFO> <collaxa> <ServerManager::loadProcesses> Done loading processes for all domains
<2007-11-26 18:35:13,296> <INFO> <default.collaxa.cube.ws> <AdapterFramework::Outbound> http://192.168.133.164:8888/orainfra/wsil/adapters/applications/CI_PERSONAL_DATA_invoke.wsdl?wsdl [ CI_PERSONAL_DATAPortType::CI_PERSONAL_DATA(input_CI_PERSONAL_DATA,output_CI_PERSONAL_DATA) ] - Using JCA Connection Pool - max size = <unbounded>
<2007-11-26 18:35:13,312> <WARN> <default.collaxa.cube.ws> <AdapterFramework::Outbound> http://192.168.133.164:8888/orainfra/wsil/adapters/applications/CI_PERSONAL_DATA_invoke.wsdl?wsdl [ CI_PERSONAL_DATAPortType::CI_PERSONAL_DATA(input_CI_PERSONAL_DATA,output_CI_PERSONAL_DATA) ] - Unable to provide Log4j handle to com.ibi.afjca.cci.IWAFConnectionFactory via <public void setLog4jLogger(org.apache.log4j.Logger logger)> due to: com.ibi.afjca.cci.IWAFConnectionFactory.setLog4jLogger(org.apache.log4j.Logger)
Mon, 26 Nov 2007 18:35:13.0312 IST - Thread[HTTPThreadGroup-59,5,HTTPThreadGroup] [debug] [IWAF JCA] IWAFConnectionFactory:getConnection called with ConnectionSpec:
User :null
Password :null
AdapterName :PeopleSoft
Config :PSOFT9
Mon, 26 Nov 2007 18:35:13.0312 IST - Thread[HTTPThreadGroup-59,5,HTTPThreadGroup] [debug] [IWAF JCA] IWAFConnectionFactory:getConnection called with ConnectionSpec:
User :null
Password :null
AdapterName :PeopleSoft
Config :PSOFT9
Mon, 26 Nov 2007 18:35:13.0312 IST - Thread[HTTPThreadGroup-59,5,HTTPThreadGroup] [debug] [IWAF JCA] IWAFManagedConnectionFactory:createManagedConnection() entered.
Mon, 26 Nov 2007 18:35:13.0312 IST - Thread[HTTPThreadGroup-59,5,HTTPThreadGroup] [debug] [IWAF JCA] setLogWriter() gets called.
07/11/26 18:35:14 PSProperties not loaded from file. Couldn't find file: pstools.properties
07/11/26 18:35:18 PSProperties not loaded from file. Couldn't find file: pstools.properties
07/11/26 18:39:12 PSProperties not loaded from file. Couldn't find file: pstools.properties
07/11/26 18:51:38 PSProperties not loaded from file. Couldn't find file: pstools.properties
Thanks,
manish
Message was edited by:
user604262 -
XML-32009: (Fatal Error) Failed to parse the input schema.
I am attempting to generate the Java classes for the attached XLM schema (JMdict_e.xsd) using the following command:
oracle.xml.jaxb.orajaxb -schema JMdict_e.xsd -targetPkg generated
which results in the error "XML-32009: (Fatal Error) Failed to parse the input schema."
I created the schema from a DTD file (http://www.csse.monash.edu.au/~jwb/jmdict_dtd_h.html) following the instructions in the example http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28394/adx_j_sproc.htm#CIHICCJB
I am using version xdk_nt_10_1_0_2_0_production.
Can anyone help me with this please? Thanks.
JMdict_e.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="dial" type="xs:string"/>
<xs:element name="example" type="xs:string"/>
<xs:element name="upd_date" type="xs:string"/>
<xs:element name="ke_pri" type="xs:string"/>
<xs:element name="re_nokanji" type="xs:string"/>
<xs:element name="xref" type="xs:string"/>
<xs:element name="etym" type="xs:string"/>
<xs:element name="re_inf" type="xs:string"/>
<xs:element name="k_ele">
<xs:complexType>
<xs:sequence>
<xs:element ref="keb"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="ke_inf"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="ke_pri"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="links">
<xs:complexType>
<xs:sequence>
<xs:element ref="link_tag"/>
<xs:element ref="link_desc"/>
<xs:element ref="link_uri"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="lsource">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="lang" fixed="eng"/>
<xs:attribute name="ls_type" use="optional" type="xs:string"/>
<xs:attribute name="ls_wasei" use="optional" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="ent_seq" type="xs:string"/>
<xs:element name="info">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="links"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="bibl"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="etym"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="audit"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="s_inf" type="xs:string"/>
<xs:element name="link_uri" type="xs:string"/>
<xs:element name="bib_txt" type="xs:string"/>
<xs:element name="link_tag" type="xs:string"/>
<xs:element name="bibl">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="bib_tag"/>
<xs:element minOccurs="0" ref="bib_txt"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="upd_detl" type="xs:string"/>
<xs:element name="ant" type="xs:string"/>
<xs:element name="ke_inf" type="xs:string"/>
<xs:element name="audit">
<xs:complexType>
<xs:sequence>
<xs:element ref="upd_date"/>
<xs:element ref="upd_detl"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="pos" type="xs:string"/>
<xs:element name="pri" type="xs:string"/>
<xs:element name="r_ele">
<xs:complexType>
<xs:sequence>
<xs:element ref="reb"/>
<xs:element minOccurs="0" ref="re_nokanji"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="re_restr"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="re_inf"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="re_pri"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="bib_tag" type="xs:string"/>
<xs:element name="re_restr" type="xs:string"/>
<xs:element name="stagk" type="xs:string"/>
<xs:element name="sense">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="stagk"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="stagr"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="pos"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="xref"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="ant"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="field"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="misc"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="s_inf"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="lsource"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="dial"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="gloss"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="example"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="keb" type="xs:string"/>
<xs:element name="field" type="xs:string"/>
<xs:element name="link_desc" type="xs:string"/>
<xs:element name="reb" type="xs:string"/>
<xs:element name="entry">
<xs:complexType>
<xs:sequence>
<xs:element ref="ent_seq"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="k_ele"/>
<xs:element maxOccurs="unbounded" ref="r_ele"/>
<xs:element minOccurs="0" ref="info"/>
<xs:element maxOccurs="unbounded" ref="sense"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="stagr" type="xs:string"/>
<xs:element name="re_pri" type="xs:string"/>
<xs:element name="gloss">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="pri"/>
</xs:choice>
<xs:attribute name="lang" fixed="eng"/>
<xs:attribute name="g_gend" use="optional" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="misc" type="xs:string"/>
<xs:element name="JMdict">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="entry"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>@Bhaskar (and @user11922800): You have to update the db10g/xdk to a version at least of 10.1.0.4. There were major bug fixes including XML-32009 error (bug number 3375952).
http://www.eygle.com/case/bug10104.htm
I've even tried the op's listing with my more to-date xdk without encountering any problem and it is compiled just fine.
ps: I am sure that was the hasty typo in dvohra16 post. The namespace in the op (/2001/) is correct. Encoding is still capable of resulting in some problems (I've had encounted if I recall), but that is not the problem for the issue raised in this thread. -
How-to use Excel for the XML file input?
Hello all,
Following our discussion with Gerhard Steinhuber on the very nice tutorial from Horst Schaude , "How to upload mass data via XML File Input" , I am starting this new discussion.
In the comments section of this previous cited tutorial, Rufat Gadirov explains how to use a generated XML from Eclipse instead of your XSD file as your source in Excel.
However, in spite of all the instructions, I am still facing the same issue in Excel when I try to save my file as XML : "The XML maps in this workbook are not exportable".
What I try to do is to create one or more Sales Orders with multiple Items in it from a XML File Input, using excel to enter data.
The part with the File input is working (if I directly upload my file to the webDAV, it creates a sales order instance with multiple items).
The only missing part is the Excel data input that I cannot make work. Any help on this matter would be greatly appreciated.
Here is my XML file that I try to use as a source in Excel before inputing data from Excel:
<?xml version="1.0" encoding="UTF-8"?>
<p:MySalesOrderUploadedIntegrationInputRequest xmlns:p="http://001365xxx-one-off.sap.com/YUUD0G3OY_" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageHeader>
<CreationDateTime>2015-03-02T12:00:00.000Z</CreationDateTime>
</MessageHeader>
<List actionCode="01" listCompleteTransmissionIndicator="true" reconciliationPeriodCounterValue="0">
<MySalesOrderUploaded>
<MySalesOrderUploadedID>idvalue0</MySalesOrderUploadedID>
<MyBuyerID schemeAgencyID="token" schemeAgencySchemeAgencyID="1" schemeID="token">token</MyBuyerID>
<MyDateTime>2015-03-02T12:00:00.000Z</MyDateTime>
<MyName languageCode="EN">MyName</MyName>
<MyBillToParty schemeAgencyID="token" schemeAgencySchemeAgencyID="1" schemeAgencySchemeID="token" schemeID="token">token</MyBillToParty>
<MyDateToBeDelivered>2001-01-01</MyDateToBeDelivered>
<MyEmployeeResponsible schemeAgencyID="token" schemeAgencySchemeAgencyID="1" schemeAgencySchemeID="token" schemeID="token">token</MyEmployeeResponsible>
<MySalesUnit schemeAgencyID="token" schemeAgencySchemeAgencyID="1" schemeAgencySchemeID="token" schemeID="token">token</MySalesUnit>
<MyItem>
<MyItemID>token</MyItemID>
<MyItemProductID schemeAgencyID="token" schemeID="token">token</MyItemProductID>
<MyItemDescription languageCode="EN">MyItemDescription</MyItemDescription>
<MyProductTypeCode>token</MyProductTypeCode>
<MyRequestedQuantity unitCode="token">0.0</MyRequestedQuantity>
<MyConfirmedQuantity unitCode="token">0.0</MyConfirmedQuantity>
<MyNetAmount currencyCode="token">0.0</MyNetAmount>
</MyItem>
</MySalesOrderUploaded>
<MySalesOrderUploaded>
<MySalesOrderUploadedID>idvalue0</MySalesOrderUploadedID>
<MyBuyerID schemeAgencyID="token" schemeAgencySchemeAgencyID="1" schemeID="token">token</MyBuyerID>
<MyDateTime>2015-03-02T12:00:00.000Z</MyDateTime>
<MyName languageCode="EN">MyName</MyName>
<MyBillToParty schemeAgencyID="token" schemeAgencySchemeAgencyID="1" schemeAgencySchemeID="token" schemeID="token">token</MyBillToParty>
<MyDateToBeDelivered>2001-01-01</MyDateToBeDelivered>
<MyEmployeeResponsible schemeAgencyID="token" schemeAgencySchemeAgencyID="1" schemeAgencySchemeID="token" schemeID="token">token</MyEmployeeResponsible>
<MySalesUnit schemeAgencyID="token" schemeAgencySchemeAgencyID="1" schemeAgencySchemeID="token" schemeID="token">token</MySalesUnit>
<MyItem>
<MyItemID>token</MyItemID>
<MyItemProductID schemeAgencyID="token" schemeID="token">token</MyItemProductID>
<MyItemDescription languageCode="EN">MyItemDescription</MyItemDescription>
<MyProductTypeCode>token</MyProductTypeCode>
<MyRequestedQuantity unitCode="token">0.0</MyRequestedQuantity>
<MyConfirmedQuantity unitCode="token">0.0</MyConfirmedQuantity>
<MyNetAmount currencyCode="token">0.0</MyNetAmount>
</MyItem>
</MySalesOrderUploaded>
</List>
</p:MySalesOrderUploadedIntegrationInputRequest>
Thank you all for your attention.
Best regards.
Jacques-Antoine OllierHello Jacques-Antoine,
I suppose that as you have tried to construct a map from the schema, you have taken the elements from the List level down. In this case I also can't export the map.
But if you take the elements from the level MySalesOrderUploaded down, you'll get the exportable map (screenshots)
Best regards,
Leonid Granatstein -
Hi,
We are using JCAPS 512. We use oracle eway to connect to Oracle 10g database. But sometimes we are getting the following exception
and suddenly all jcds stop processing. If we restart the server again job continue processing, otherwise server hangs and nothing get processed.
Exception is as follows
java.sql.SQLException: File input/output error: File input/output error: reading: java.io.EOFException in statement [SET TABLE EVENT_STORE INDEX '11183416 55935']
at org.hsqldb.Trace.getError(Unknown Source)
at org.hsqldb.Log.runScript(Unknown Source)
at org.hsqldb.Log.open(Unknown Source)
at org.hsqldb.Database$Logger.openLog(Unknown Source)
at org.hsqldb.Database.open(Unknown Source)
at org.hsqldb.Database.<init>(Unknown Source)
at org.hsqldb.jdbcConnection.openStandalone(Unknown Source)
at org.hsqldb.jdbcConnection.<init>(Unknown Source)
at org.hsqldb.jdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at com.stc.eventmanagement.impl.DBEventStore$EventStoreDB.addNewConnection(DBEventStore.java:359)
at com.stc.eventmanagement.impl.DBEventStore$EventStoreDB.getConnection(DBEventStore.java:444)
at com.stc.eventmanagement.impl.DBEventStore$EventStoreDB.executeParameterizedQuery(DBEventStore.java:777)
at com.stc.eventmanagement.impl.DBEventStore$EventStoreDB.access$000(DBEventStore.java:250)
at com.stc.eventmanagement.impl.DBEventStore.getEventIDsList(DBEventStore.java:133)
at com.stc.eventmanagement.impl.DBEventStore.getEventIDsList(DBEventStore.java:115)
at com.stc.eventmanagement.impl.EventForwarderMBean.cachePersistedEvents(EventForwarderMBean.java:728)
at com.stc.eventmanagement.impl.EventForwarderMBean.setup(EventForwarderMBean.java:334)
at com.stc.eventmanagement.impl.EventForwarderMBean.invoke(EventForwarderMBean.java:565)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
at com.stc.eventmanagement.impl.EventManagementService.setupEventForwarderMbean(EventManagementService.java:270)
at com.stc.eventmanagement.impl.EventManagementService.registerMBean(EventManagementService.java:147)
at com.stc.eventmanagement.impl.EventManagementService.startService(EventManagementService.java:96)
at com.stc.eventmanagement.impl.EventManagementResourceAdapter.start(EventManagementResourceAdapter.java:75)
at com.sun.enterprise.connectors.ActiveInboundResourceAdapter.<init>(ActiveInboundResourceAdapter.java:94)
at com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:74)
at com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:269)
at com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:372)
at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:204)
at com.sun.enterprise.server.ConnectorModuleLoader.load(ConnectorModuleLoader.java:87)
at com.sun.enterprise.server.ConnectorModuleLoader.load(ConnectorModuleLoader.java:108)
at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:216)
at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:106)
at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:183)
at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:295)
at com.sun.enterprise.server.PEMain.run(PEMain.java:238)
at com.sun.enterprise.server.PEMain.main(PEMain.java:186)
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 org.apache.commons.launcher.ChildMain.run(ChildMain.java:269)
|#]
Please provide some suggestions to overcome this error
Regards
Venkatesh.SDelete the EventStoreDb.data file (its somewhere in your logical host) and restart the logical host.
-
How to get file input stream from the client machine by JSF Fileupload API?
Dear Friends,
How to get the file input stream from the client machine by JSF HtmlFileupload or fileupload API. At present, if i execute the file upload code in the client machine, it is able to get the local path of the file and looking for the file in server machine. So i am getting FileNotFoundException.
E.g., If a file is located at client machine at following location means "C:\Test\Test.txt",
uploadClass.getFileuploadComponent().getFilename().toString() returns "C:\Test\Test.txt". But it is looking for that file in server and throwing FileNotFoundException.
Please post your replies soon.
Thanks,
JPDepends on which version of JSF you're using. If JSF 1.2, I wouldn't even bother trying to hack this into JSF itself unless you can use something like Seam 2 or richfaces.
http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_fileUpload.html
http://docs.jboss.org/seam/2.2.1.CR3/reference/en-US/html/controls.html#d0e29259 (look for s:fileUpload)
But if I were you, a simple non-jsf form with a servlet works best for taking file uploads.
As for JSF 2.0, there are other ways of getting it done.
http://balusc.blogspot.com/2009/12/uploading-files-with-jsf-20-and-servlet.html -
Wrong result then parsing file in applet
My applet is parsing a 3ds-file and it's working good in both applet viewer and as a stand alone application but then i try it as an applet in a browser it sometimes parses wrong.
This is the printout i get then parsing is correct:
Found data/model/chest.3ds in jar file.
main chunk
unused chunks : 2 with length: 10
3d editor chunk
unused chunks : 3d3e with length: 10
unused chunks : ffffafff with length: 170
unused chunks : 100 with length: 10
object chunk
Namnet p� objektet �r inl�st: Chest01
triangular mesh chunk
vertices list chunk
Antalet vertices 424
Antalet uv-koordinater 424
unused chunks : 4160 with length: 54
Antalet faces 168
unused chunks : 4130 with length: 349
unused chunks : 4150 with length: 678
unused chunks : ffffb000 with length: 221
This is the printout then run in an applet:
Found data/model/chest.3ds in jar file.
main chunk
unused chunks : 2 with length: 10
3d editor chunk
unused chunks : 3d3e with length: 10
unused chunks : ffffafff with length: 170
unused chunks : 100 with length: 10
object chunk
Namnet p� objektet �r inl�st: Chest01
triangular mesh chunk
vertices list chunk
Antalet vertices 424
Antalet uv-koordinater 424
unused chunks : ffffed3e with length: -1572921687
unused chunks : 7856 with length: 1381233982
This problem only occurs in some files.
I'm parsing it by reading in the correct number of bytes and converting them to the correct type (int, char ..ect).
Is there any difference in parsing files in a browser than in an application? The only difference I had so far is the browser beeing case sensitive in the filenames then the appletviewer isn't.
I can post the code if you want to.
Please help me, thanks.
/ RobertIfanyone else having the same trouble I'm publishing the wrapper I used successfully.
private static void read(InputStream in, byte[] buffer) throws IOException
int bytesRead = 0;
int bytesToRead = buffer.length;
while (bytesToRead > 0)
int read = in.read(buffer, bytesRead, bytesToRead);
bytesRead += read;
bytesToRead -= read;
} -
I have a FILE Adapter using FTP as a transport that is generating a very odd error.
The FTP sender channel is giving the following error is set up to retreive all files (*) from a specific directory. If you look at the error, it indicates an error processing the file 'Input 110110b.txt' as a file -- the only way this filename woudl be visible is if the adapater interrogated the directory, or the filename was hard-coded in the file mask. But the error indicates it can't change to the directory. The only way it would have come up with the file is if it had already CD'd t that directory.
1/7/11 8:12:01 AM Retry interval started. Length: 60.0 seconds
1/7/11 8:12:01 AM Could not process file 'Input 110110b.txt': com.sap.aii.adapter.file.ftp.FTPEx: 550 Failed to change directory.
1/7/11 8:12:00 AM Processing started
My first thought was a simple permission issue, so I opened a connection to server with FileZilla (an FTP client) and was able to retrieve the file without a problem. I was also able to drop a file in the directory. There is no permissions problem.Hi
Please check the below points before processing any file
a) check the File placing by a Local Plant FTP owner is using the same authentification credentials It means both PI and source team needs to use same FTP User ID and login credentials otherwise if suppose if source team is placing with one User and PI cannot able to pick that file as this User cannot have permissions in this case also u will get 550 error
b) I know what ur telling is u manualy palced one file and able retrive...but do one thing u can login with same PI FTP login server credentials and then place the file with different name also I suggest lets test the channel by simply keeping
. not simply * if you keep simply * then u cna use in receiver chanel while using dynamic connfiguration.
Else give *.txt and then activate the channel and also please check the CACHE as well
Regards
Amar Srinivas Eli -
Can't get java to read my file input
I have a program that ask at prompt what the name of your input file will be... something for example like input.txt can be typed and a scanner puts that text "input.txt" into a string called maybe inputs.
The problem I am having is I can not get the scanner to then look at the string and open the file with the same name in the folder and read it.
I not sure if im putting the name correct in the new File so to make it look at "input.txt" and I keep getting Class FileNotFoundException
any ideas?
my code is below
File f = new File(inputs);
Scanner scan = new Scanner( f );
String name = "";
while(scan.hasNextLine()) // as long as there is another line to be read
String text = scan.nextLine(); // read the first line
Scanner scan2 = new Scanner(text); // set up a second scanner to process the String we just read in
if(scan2.hasNext())
name = scan2.next();
else
continue; // go to the next line
System.out.println(name);
}Java is likely looking for your file in a location other than where the file is. Do you know where your current user.dir is? Create a small program that does nothing but this:
class Fubar
public static void main(String[] args)
System.out.println(System.getProperty("user.dir"));
}Edited by: Encephalopathic on Mar 23, 2009 7:10 PM -
Does parse file change on v3.0 ?
Hi everybody
I tried to create parse file on 3.0 version of Apex with the same rules as old version. It didn't work.
Before 3.0 we had
In the page process "Parse file", it has...
htmldb_tools.parse_file(:P1_FILENAME,'P1_COLLECTION','P1_HEADINGS','P1_COLUMNS','P1_DDL');
And on 3.0 ? I tried
In the page process "Parse file", it has...
apex_tools.parse_file(:P1_FILENAME,'P1_COLLECTION','P1_HEADINGS','P1_COLUMNS','P1_DDL');
But It didn't work
Please follow me the right way ^^
Regards
Message was edited by:
user450801Hi user450801,
you have to be a little bit more patient. It's weekend!
The htmldb_tools package is a package written by Vikas (http://htmldb.oracle.com/pls/otn/f?p=38131:1) which doesn't have to do anything with the upgrade of APEX to 3.0.
As long as you haven't renamed your package to APEX_TOOLS it will still be accessible as HTMLDB_TOOLS.
Patrick
My APEX Blog: http://inside-apex.blogspot.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/ -
Re: File Input Streams FileNotFoundException
Hi,
I'm having problems with file input streams.
The program is supposed to read from an external file but when I run it in Sun ONE Studio 4 (update 1), it gives me a FileNotFoundException (The system cannot find the file specified). The file, class.dat, is in the same folder as the .java and .class files.
Anyway, so I run the program through MS-Prompt commands and there is no problem. It executes fine and gives the right output. Go figure.
Can anyone shed some light on what is going on? Anyone else with the same problem? Is there something I need to configure in SunStudio? Please help...
Thanks
The code is taken directly from Sams Java in 21 days.
// code
import java.io.*;
public class ReadBytes {
public static void main(String[] arguments) {
try {
FileInputStream file = new
FileInputStream("class.dat");
boolean eof = false;
int count = 0;
while (!eof) {
int input = file.read();
System.out.print(input + " ");
if (input == -1)
eof = true;
else
count++;
file.close();
System.out.println("\nBytes read: " + count);
} catch (IOException e) {
System.out.println("Error -- " + e.toString());FileInputStream file = new FileInputStream("class.dat");Is this the line that is giving you the error message? Always, when trying to open a disk file, give the full path. This is because, FileNotFoundException is thrown only in cases when your file cannot be found by your program. But you say that the file exists.
Try giving your full path for the file...like:
FileInputStream file = new FileInputStream("C:/Program Files/class.dat");
//Ofcourse your path will be different. This is just an example!So try giving the full path and let me know.
Vijay :-) -
File Input Adapter - Dynamic Mode
Hi,
I want to use dynamicFile and dynamicPath together for file input adapter but I am getting error when I write both of them in DynamicMode parameter. Is it possible somehow?
Let me explain my scneario. A server is generating logs and I need to read them from ESP. The server writes logs in a file and when size of the file reaches 100MB, logs are started to be written a new log file. So, I need to read each newly coming data from a single log file and also get entries from a new file if previous log file reaches its maximum size.
How can I handle this kind of request?
Thanks and regards,
BulutHi Alice,
To be able to use wildcard in the File Parameter, I should choose dynamicPath in dynamicMode paramater. But when I choose dynamicPath, adaptor didn’t read newly written entries (incremental data) in log files.
Vice versa, to able to get incremental data from a log file I should choose dynamicFile in dynamicMode. This time, I could not use wildcard (*) and I should specify a certain file in File Parameter.
you can see my adapter codes below:
1- DynamicFile
CREATE INPUT WINDOW InputWindow1 SCHEMA (
Column1 string ,
Column2 string ) PRIMARY KEY ( Column1 ) ;
ATTACH INPUT ADAPTER File_Hadoop_CSV_Input1 TYPE toolkit_file_csv_input TO InputWindow1 PROPERTIES csvExpectStreamNameOpcode = FALSE ,
dir = 'E:/gg/t' ,
file = 'new2.txt' ,
dynamicMode = 'dynamicFile' ,
removeAfterProcess = FALSE ,
csvDelimiter = ',' ,
csvDateFormat = '' ,
csvTimestampFormat = '' ,
csvHasHeader = FALSE ,
pollingPeriod = 5 ,
scanDepth = 0 ;
2- DynamicPath
CREATE INPUT WINDOW InputWindow1 SCHEMA (
Column1 string ,
Column2 string ) PRIMARY KEY ( Column1 ) ;
ATTACH INPUT ADAPTER File_Hadoop_CSV_Input1 TYPE toolkit_file_csv_input TO InputWindow1 PROPERTIES csvExpectStreamNameOpcode = FALSE ,
dir = 'E:/gg/t' ,
file = '*' ,
dynamicMode = 'dynamicPath' ,
removeAfterProcess = FALSE ,
csvDelimiter = ',' ,
csvDateFormat = '' ,
csvTimestampFormat = '' ,
csvHasHeader = FALSE ,
pollingPeriod = 5 ,
scanDepth = 0 ;
My new2.txt file includes:
A,A
B,B
C,C
D,D,
I could not find a way to handle this situation. Do you have any idea? How can I use both dynamicFile and dynamicPath options together?
Regards,
Bulut -
Form validation for file inputs
Hi,
Does anybody know if Spry can do a file input validation? I'm
interested at least to check if the file is empty or not.
Thanksis this a JavaScript question or a Java queston ?
Maybe you are looking for
-
I have a mid 2010, Macbook Pro '15. Summer of 2012, it kept shutting down and making the three beeping noises, so I took it in for repair. I was told that my Logicboard needed to be replaced, so I replaced it, and took my Macbook abroad with me. Half
-
Ifilter does not update Outlook to search for attachment content
We are using Windows 7 and Outlook 2014, 64 bit I installed the iFilter application (9 for 64-bit platforms). I can now search attachment content (PDF) using Windows explorer. But, i cannot search attachment content in Outlook. I did follow instructi
-
I've been following the Field Engineer example project from the Windows Development Center to guide into mapping many-to-many relationships on my model. What's been bothering me is how to insert entries into many-to-many relationships. Take my model
-
Calendar does not work properly!!! Why? Please help...
Hello everybody! I'm getting problems with calendar and I don't know what to do... I'm in Brazil, Sao Paulo and I instantiate the Calendar class like this: Calendar cal = Calendar.getInstance(); System.out.println(cal.getTime()); when i do this the t
-
I would like to have 2 iCloud accounts on my Appleid account. While I would like to share apps and music with my husband, we need to maintain separate contacts and calendars. How do I set up the second iCloud account?