Problem with file length in jsp it is working in IE, not workig Firefox
Hi,
I'm upload a file from the browser. i'm calculating the length i'm not getting the length of the file.
The below shown code is working perfectly in IE and not working in Firefox.
FileUpload.html
<DOCTYPE>
<HTML>
<HEAD>
<TITLE>Retailmint Jobs - Registration Form</TITLE>
</HEAD>
<BODY>
<form>
<table>
<tr><td>Upload Resume :</td>
<td> <input>
</td>
</tr>
</table>
<input>
</p>
<p> </p>
</form>
</BODY>
</HTML>
FileUploadSubmit.jsp
<page>
<page>
<page>
<html>
<head><title>Retailmint- Submission</title></head>
<body>
<FileInputStream>
</body>
</html>
I find an error in firefox browser is not taking the fully qualified path
i.e: C:\Documents and Settings\Administrator\Desktop\if.doc
In firefox it is taking if.doc only.
please tell me the solution.
Regards
venkat
Sorry for that
here is the code:
FileUpload.html
<HTML>
<HEAD>
<TITLE>Retailmint Jobs - Registration Form</TITLE>
<script language="Javascript" src="FileRead.js">
</script>
</HEAD>
<BODY>
<form name='subregiform' method="get" action ="FileuploadSubmit.jsp" >
<table width="566" border="0" cellspacing="0" cellpadding="0">
<tr><td width="197"align="right">Upload Resume :</td>
<td width="369"> <input type="file" name="file" value ="" onchange ="javascript:fopen('file');"><br>
</td>
</tr>
</table><br>
<input type="submit" name="submit" value="Submit">
</strong></p>
<p> </p>
</form>
</BODY>
</HTML>
FileUploadSubmit.jsp
<%@ page import="java.text.*"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<jsp:useBean id="DBase" class="dbconnection.DBconnection" scope="session" />
<html>
<head><title>Retailmint- Submission</title>
</head>
<body bgcolor="#e0e0e0">
<%
FileInputStream fis = new FileInputStream(request.getParameter("file"));
len = (int)file.length();
System.out.println("length"+len);
%>
</body>
</html>
And tell me How to find the absolute path of a file in JSP or JAVA?
Similar Messages
-
Problem with file length in jsp it is working in IE, not working Firefox
Hi,
I'm upload a file from the browser. i'm calculating the length i'm not getting the length of the file.
The below shown code is working perfectly in IE and not working in Firefox.
FileUpload.html
<DOCTYPE>
<HTML>
<HEAD>
<TITLE>Retailmint Jobs - Registration Form</TITLE>
</HEAD>
<BODY>
<form>
<table>
<tr><td>Upload Resume :</td>
<td> <input>
</td>
</tr>
</table>
<input>
</p>
<p> </p>
</form>
</BODY>
</HTML>
FileUploadSubmit.jsp
<page>
<page>
<page>
<html>
<head><title>Retailmint- Submission</title></head>
<body>
<FileInputStream>
</body>
</html>
I find an error in firefox browser is not taking the fully qualified path
i.e: C:\Documents and Settings\Administrator\Desktop\if.doc
In firefox it is taking if.doc only.
please tell me the solution.
Regards
venkatI agree with your words
sorry for the code pasting.
Here is the code:
FileUpload.html
<HTML>
<HEAD>
<TITLE>Retailmint Jobs - Registration Form</TITLE>
</HEAD>
<BODY>
<form name='subregiform' method="get" action ="FileuploadSubmit.jsp" >
<table width="566" border="0" cellspacing="0" cellpadding="0">
<tr><td width="197"align="right">Upload Resume</td>
<td width="369"> <input type="file" name="file" value ="" >
</td>
</tr>
</table>
<input type="submit" name="submit" value="Submit">
</form>
</BODY>
</HTML>
FileUploadSubmit.jsp
<%@ page import="java.text.*"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<html>
<head><title>Retailmint- Submission</title>
</head>
<body bgcolor="#e0e0e0">
<%
FileInputStream fis = new FileInputStream(request.getParameter("file"));
len = (int)file.length();
System.out.println("length"+len);
%>
</body>
</html>
And how to find the absolute path of a file in jsp or java
Edited by: venkat.k on Sep 17, 2007 10:12 PM -
Problem with file length in jsp IE it is working Firefox it is not workig
Hi,
I'm upload a file from the browser. i'm calculating the length i'm not getting the length of the file.
The below shown code is working perfectly in IE and not working in Firefox.
FileUpload.html
<DOCTYPE>
<HTML>
<HEAD>
<TITLE>Retailmint Jobs - Registration Form</TITLE>
</HEAD>
<BODY>
<form>
<table>
<tr><td>Upload Resume :</td>
<td> <input>
</td>
</tr>
</table>
<input>
</p>
<p> </p>
</form>
</BODY>
</HTML>
FileUploadSubmit.jsp
<page>
<page>
<page>
<html>
<head><title>Retailmint- Submission</title></head>
<body>
<FileInputStream>
</body>
</html>
I find an error in firefox browser is not taking the fully qualified path
i.e: C:\Documents and Settings\Administrator\Desktop\if.doc
In firefox it is taking if.doc only.
please tell me the solution.
Regards
venkatSorry for that
here is the code:
FileUpload.html
<HTML>
<HEAD>
<TITLE>Retailmint Jobs - Registration Form</TITLE>
<script language="Javascript" src="FileRead.js">
</script>
</HEAD>
<BODY>
<form name='subregiform' method="get" action ="FileuploadSubmit.jsp" >
<table width="566" border="0" cellspacing="0" cellpadding="0">
<tr><td width="197"align="right">Upload Resume :</td>
<td width="369"> <input type="file" name="file" value ="" onchange ="javascript:fopen('file');"><br>
</td>
</tr>
</table><br>
<input type="submit" name="submit" value="Submit">
</strong></p>
<p> </p>
</form>
</BODY>
</HTML>
FileUploadSubmit.jsp
<%@ page import="java.text.*"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<jsp:useBean id="DBase" class="dbconnection.DBconnection" scope="session" />
<html>
<head><title>Retailmint- Submission</title>
</head>
<body bgcolor="#e0e0e0">
<%
FileInputStream fis = new FileInputStream(request.getParameter("file"));
len = (int)file.length();
System.out.println("length"+len);
%>
</body>
</html>
And tell me How to find the absolute path of a file in JSP or JAVA? -
Problem with file download through JSP under WLS6.1 SP3
Hello,
We're in the process of trying to migrate from WLS 6.1 SP1 to SP3, and we're encountering
some difficulties with this migration.
I'm attaching a very simple JSP here - it's a snippet from a larger more dynamic
JSP, that I managed to narrow down to a pretty simple case which still doesn't
work.
This JSP opens a file residing at "c:\\BDELog.txt" (it's hardcoded - so change
it to any textual local file on your machine in order to test it), and writes
it to the output stream as a txt attachment.
This JSP works perfectly well on SP1, however, on SP3, it fails only during the
first hit. If you call this JSP again from the same browser window - it'll work.
Needless to say - this isn't an acceptable behavior for a website.
Hope you can help.
Appreciate any response.
Roy.
[download.jsp]SP4 indeed solved it.
Thanks again!
Roy.
"Eric Gross" <[email protected]> wrote:
As a follow-up, SP4 is now available.
Regards,
Eric
"Eric Gross" <[email protected]> wrote in message
news:3dd19974$[email protected]..
I would wait until SP4(I believe it may be coming out this week actually).
If you can't wait until then, please contact support for a 1-off patch.
Regards,
Eric
"Roy Abitbol" <[email protected]> wrote in message
news:3dd10ef1$[email protected]..
Many thanks !! (sigh of relief...)
Is there a way to work around this problem - for example - write
the
header explicitly
so that the problematic header will be overriden or simply get a
patch
from you
guys ?
Or do we have to wait for SP4 ?
Thanks again,
Roy.
"Eric Gross" <[email protected]> wrote:
This is a known issue and has been fixed.
The fix is in SP4. This has to do with a bug that IE has with respect
to a
header:
Cache-Control: no-cache="set-cookie"
We introduced that as the default header to be returned on all
responses.
As of SP4(due out very soon), the default behaviour will be notto send
this
header back with each response.
Regards,
Eric
"Roy Abitbol" <[email protected]> wrote in message
news:3dca7f19$[email protected]..
Hello,
We're in the process of trying to migrate from WLS 6.1 SP1 to
SP3,
and
we're encountering
some difficulties with this migration.
I'm attaching a very simple JSP here - it's a snippet from a largermore
dynamic
JSP, that I managed to narrow down to a pretty simple case which
still
doesn't
work.
This JSP opens a file residing at "c:\\BDELog.txt" (it's hardcoded- so
change
it to any textual local file on your machine in order to test
it),
and
writes
it to the output stream as a txt attachment.
This JSP works perfectly well on SP1, however, on SP3, it fails
only
during the
first hit. If you call this JSP again from the same browser window- it'll
work.
Needless to say - this isn't an acceptable behavior for a website.
Hope you can help.
Appreciate any response.
Roy. -
Problem with file access in other computer in jsp
I have problem with file accessing in other computer in jsp.
The follow code
File folder=new File("Z:"+File.separator+"sharefolder");//Z is a net share driver
File[] files=folder.listFiles();
System.out.println("test");
System.out.println("length="+files.length);
will throw exception at the second print.
but it works well in main funtion.
Is anybody know what is the problem.
JSP works on windows2003 server,tomcat 5.0.28 JDK1.4 net share folder on windows2000 serverno error code for this.But when I start tomcat I get the follow error.
java.lang.IllegalArgumentException: Document base Z:\ does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:138)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4138)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903)
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.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
at org.apache.commons.digester.Rule.end(Rule.java:276)
at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1567)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
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.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
Jun 5, 2006 6:55:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Error in resourceStart()
Jun 5, 2006 6:55:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Jun 5, 2006 6:55:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Context startup failed due to previous errors
Jun 5, 2006 6:55:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Exception during cleanup after start failed
LifecycleException: Container StandardContext[msgstore] has not been started
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4466)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903)
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.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
at org.apache.commons.digester.Rule.end(Rule.java:276)
at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1567)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
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.catalina.startup.Bootstrap.start(Bootstrap.java:287) -
Problem with file descriptors not released by JMF
Hi,
I have a problem with file descriptors not released by JMF. My application opens a video file, creates a DataSource and a DataProcessor and the video frames generated are transmitted using the RTP protocol. Once video transmission ends up, if we stop and close the DataProcessor associated to the DataSource, the file descriptor identifying the video file is not released (checkable through /proc/pid/fd). If we repeat this processing once and again, the process reaches the maximum number of file descriptors allowed by the operating system.
The same problem has been reproduced with JMF-2.1.1e-Linux in several environments:
- Red Hat 7.3, Fedora Core 4
- jdk1.5.0_04, j2re1.4.2, j2sdk1.4.2, Blackdown Java
This is part of the source code:
// video.avi with tracks audio(PCMU) and video(H263)
String url="video.avi";
if ((ml = new MediaLocator(url)) == null) {
Logger.log(ambito,refTrazas+"Cannot build media locator from: " + url);
try {
// Create a DataSource given the media locator.
Logger.log(ambito,refTrazas+"Creating JMF data source");
try
ds = Manager.createDataSource(ml);
catch (Exception e) {
Logger.log(ambito,refTrazas+"Cannot create DataSource from: " + ml);
return 1;
p = Manager.createProcessor(ds);
} catch (Exception e) {
Logger.log(ambito,refTrazas+"Failed to create a processor from the given url: " + e);
return 1;
} // end try-catch
p.addControllerListener(this);
Logger.log(ambito,refTrazas+"Configure Processor.");
// Put the Processor into configured state.
p.configure();
if (!waitForState(p.Configured))
Logger.log(ambito,refTrazas+"Failed to configure the processor.");
p.close();
p=null;
return 1;
Logger.log(ambito,refTrazas+"Configured Processor OK.");
// So I can use it as a player.
p.setContentDescriptor(new FileTypeDescriptor(FileTypeDescriptor.RAW_RTP));
// videoTrack: track control for the video track
DrawFrame draw= new DrawFrame(this);
// Instantiate and set the frame access codec to the data flow path.
try {
Codec codec[] = {
draw,
new com.sun.media.codec.video.colorspace.JavaRGBToYUV(),
new com.ibm.media.codec.video.h263.NativeEncoder()};
videoTrack.setCodecChain(codec);
} catch (UnsupportedPlugInException e) {
Logger.log(ambito,refTrazas+"The processor does not support effects.");
} // end try-catch CodecChain creation
p.realize();
if (!waitForState(p.Realized))
Logger.log(ambito,refTrazas+"Failed to realize the processor.");
return 1;
Logger.log(ambito,refTrazas+"realized processor OK.");
/* After realize processor: THESE LINES OF SOURCE CODE DOES NOT RELEASE ITS FILE DESCRIPTOR !!!!!
p.stop();
p.deallocate();
p.close();
return 0;
// It continues up to the end of the transmission, properly drawing each video frame and transmit them
Logger.log(ambito,refTrazas+" Create Transmit.");
try {
int result = createTransmitter();
} catch (Exception e) {
Logger.log(ambito,refTrazas+"Error Create Transmitter.");
return 1;
} // end try-catch transmitter
Logger.log(ambito,refTrazas+"Start Procesor.");
// Start the processor.
p.start();
return 0;
} // end of main code
* stop when event "EndOfMediaEvent"
public int stop () {
try {
/* THIS PIECE OF CODE AND VARIATIONS HAVE BEEN TESTED
AND THE FILE DESCRIPTOR IS NEVER RELEASED */
p.stop();
p.deallocate();
p.close();
p= null;
for (int i = 0; i < rtpMgrs.length; i++)
if (rtpMgrs==null) continue;
Logger.log(ambito, refTrazas + "removeTargets;");
rtpMgrs[i].removeTargets( "Session ended.");
rtpMgrs[i].dispose();
rtpMgrs[i]=null;
} catch (Exception e) {
Logger.log(ambito,refTrazas+"Error Stoping:"+e);
return 1;
return 0;
} // end of stop()
* Controller Listener.
public void controllerUpdate(ControllerEvent evt) {
Logger.log(ambito,refTrazas+"\nControllerEvent."+evt.toString());
if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
} else if (evt instanceof EndOfMediaEvent) {
Logger.log(ambito,refTrazas+"\nEvento EndOfMediaEvent.");
this.stop();
else if (evt instanceof ControllerClosedEvent)
Logger.log(ambito,refTrazas+"\nEvent ControllerClosedEvent");
close = true;
waitSync.notifyAll();
else if (evt instanceof StopByRequestEvent)
Logger.log(ambito,refTrazas+"\nEvent StopByRequestEvent");
stop =true;
waitSync.notifyAll();
Many thanks.Its a bug on H263, if you test it without h263 track or with other video codec, the release will be ok.
You can try to use a not-Sun h263 codec like the one from fobs or jffmpeg projects. -
Problem with File Uploading.
Hi,
I have one problem with File Upload component.
JSP
<ui:upload binding="#{NewProblem.fileUpload1}" columns="#{SessionBean1.uploadedFile}" id="fileUpload1" labelLevel="3"
style="left: 24px; top: 24px; position: absolute" validator="#{NewProblem.fileUpload1_validate}"/>
Java
UploadedFile uploadedFile = getSessionBean1().getUploadedFile();
Variable uploadedFile is NULL :(((((((((((
web.xml
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<filter>
<filter-name>UploadFilter</filter-name>
<filter-class>com.sun.web.ui.util.UploadFilter</filter-class>
<init-param>
<param-name>maxSize</param-name>
<param-value>10000000</param-value>
</init-param>
<init-param>
<param-name>sizeThreshold</param-name>
<param-value>10024</param-value>
</init-param>
</filter>
Thanks.check out the fileUpload article
Using the File Upload Component
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/file_upload.html -
NT security problems with file I/O
I have 2 problems with file I/O. When I read from a file I use the getAbsolutePath() method that is part of the File class to find what directory the files are currenlty. The problem is that the returned path says that the file is on the desktop no matter what directory the file really is in. The second problem is that I am unable to save files anywhere but the desktop. I must run the class files from the desktop too to get it to work.
I am using NT 4.0 for development. I'm guessing that these problems might be NT security related. Could someone help me?
Code below:
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.File;
import java.awt.event.*;
//import java.security.*;
//import sun.security.*;
//import java.awt.Window;
//import com.ms.security.*;
public class Edit extends Applet implements ActionListener, ItemListener
String Gselect;
reader readit;
int mhz, khz;
TextField textField1;
String freq = "000.000";
String data;
Choice freqC;
Button ActivateB, SaveB, /*CancelB, HelpB,*/ DeleteB;
Checkbox SetC;
int NotUsedReply[] = new int[200];
int HwListReply[] = new int[200];
public void init()
readit = new reader();
String myFile="satellite.st1";
// myFile = myFile.concat(Gselect);
File satellite = new File(myFile);
textField1 = new TextField();
textField1.setText( "(void) " );
add( textField1 );
SetC = new Checkbox("TRAP-RX");
add(SetC);
SetC.addItemListener(this);
freqC = new Choice();
freqC.setSize(20,50);
freqC.add("000.000");
add(freqC);
freqC.addItemListener(this);
ActivateB = new Button("Activate");
add(ActivateB);
ActivateB.addActionListener(this);
SaveB = new Button("Save");
add(SaveB);
SaveB.addActionListener(this);
DeleteB = new Button("Delete");
add(DeleteB);
DeleteB.addActionListener(this);
/*CancelB = new Button("Cancel");
add(CancelB);
CancelB.addActionListener(this);
HelpB = new Button("Help");
add(HelpB);
HelpB.addActionListener(this);*/
//textField1.setText( data );
for(int a = 1; a < 9; a++)
data = readit.getData(satellite.getAbsolutePath(), a);//("E:\\forte4j\\system\\Projects\\Zebra\\satellite.st1", a);
freqC.addItem(data);
textField1.setText(satellite.getAbsolutePath() );
public void paint(Graphics g)
//g.drawString("Radio Setup Files",20, 20);
//g.drawString(getParameter("wse"),20, 20);
public void actionPerformed(ActionEvent event)
if(event.getSource() == ActivateB)
activator();
if(event.getSource() == SaveB)
/*if(event.getSource() == CancelB)
stop();
if(event.getSource() == HelpB)
if(event.getSource() == DeleteB)
public void itemStateChanged(ItemEvent e)
if(e.getItemSelectable() == SetC)
textField1.setText("Check box 1 clicked!");
if(e.getItemSelectable() == freqC)
freq = ((Choice)e.getItemSelectable()).getSelectedItem();
public void activator()
makeMHZ();
makeKHZ();
if(mhz > 254)
int StartLink[]={0x0c,0x01,0x07,0x00,0x00,0x00,0x00,0x00,0x00}; //New Link Proc Start
int TrapConfig[]={0x25,0x80,0x00,0x00,0x00,0xb7,0x00,0x0c,0x0b, //TRAP Configuration
0x00,0x00,0x00,0xff,0xa0,0xff,0x0d,0xff,0xe8,
0xff,0x0d,0xff,0x00,0xff,0x15,0xff,0xb0,0xff,
0xff,0xff,0x94,0x0a,0x01,0x06,0x1a,0x00,0x0d,
0x2d,0x21};
TrapConfig[11]=(mhz-255);
TrapConfig[12]=(khz/5);
int SetUserOutput[]={0x41,0x42,0x49,0x54,0x52,0x41,0x50,0x20,0x34, //Sets User Output Format
0x35,0x34,0x35,0x30,0x30,0x2e,0x30,0x4e,0x30,
0x38,0x32,0x34,0x35,0x30,0x30,0x2e,0x30,0x57,
0x30,0x31,0x30,0x30,0x2e,0x30,0x30,0x4b,0x4d,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00};
sendget CmdFunc;
CmdFunc=new sendget();
try
//PolicyEngine.assertPermission(PermissionID.SYSTEM);
Socket h = new Socket("192.9.200.155",9000);
Socket s = new Socket("192.9.200.155",9001);
Socket t = new Socket("192.9.200.155",9002);
int j;
CmdFunc.SendCmd(h,0,0x01,null);
CmdFunc.GetCmd(h,HwListReply);
CmdFunc.SendCmd(s,9,0x1e,StartLink); //New Link Proc Start
CmdFunc.GetCmd(s,NotUsedReply);
CmdFunc.SendCmd(s,37,0x00,TrapConfig); //TRAP Configuration
CmdFunc.GetCmd(s,NotUsedReply);
CmdFunc.SendCmd(s,155,0x03,SetUserOutput);//Sets User Output Format
CmdFunc.GetCmd(s,NotUsedReply);
catch(Exception e){}
else
textField1.setText( "000.000 is the null choice. Try another." );
public void receiveText1( String select )
Gselect=select;
public void makeMHZ()
String y = freqC.getSelectedItem();
y = y.substring(0,3);
mhz = Integer.parseInt(y);
//textField1.setText( y );
public void makeKHZ()
String y = freqC.getSelectedItem();
y = y.substring(4,7);
khz = Integer.parseInt(y);
//textField1.setText( y );
import java.awt.*;
import java.applet.*;
import java.io.RandomAccessFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.LineNumberReader;
import java.awt.event.*;
import com.ms.security.*;
import netscape.security.*;
import netscape.util.*;
public class saver extends Applet implements ActionListener
String nameS = "Data.txt";
String dataS = "Default Data";
Button saveB;
public void init()
saveB = new Button("SaveFile");
add(saveB);
saveB.addActionListener(this);
public void actionPerformed(ActionEvent event)
if(event.getSource() == saveB)
RandomAccessFile RAF;
byte array0[] = dataS.getBytes();
try
if (Class.forName("com.ms.security.PolicyEngine") != null)
PolicyEngine.assertPermission(PermissionID.SYSTEM);
if(Class.forName("netscape.security.PrivilegeManager") != null)
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");
catch (Throwable cnfe)
try
RAF = new RandomAccessFile(nameS, "rw");
// RAF.writeUTF(dataS);
RAF.write(dataS.getBytes());
RAF.close();
catch(Exception e)
public void receiveND(String name, String data)
if(name != null)
nameS = name;
dataS=data;
import java.io.RandomAccessFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.LineNumberReader;
//import java.security.*;
import com.ms.security.*;
import netscape.security.*;
import netscape.util.*;
public class reader
//Signature sig;
public String getData(String filename, int pass)
//String nameS = "Data.txt";
String dataS = "Default Data Sucks";
String comma = ",";
int get = pass, count=0, top=0, bottom=0;
char[] work;
try
if (Class.forName("com.ms.security.PolicyEngine") != null)
PolicyEngine.assertPermission(PermissionID.SYSTEM);
if(Class.forName("netscape.security.PrivilegeManager") != null)
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
catch (Throwable cnfe)
try
//sig.sign();
//nameS = filename;
RandomAccessFile RAF = new RandomAccessFile(filename, "r");
// dataS = RAF.readUTF();
dataS = RAF.readLine();
RAF.close();
catch(Exception e)
return e.toString();
work = dataS.toCharArray();
for(int i = 0; i < dataS.length(); i++)
if( work[i] == ',' )
count++;
if(get == count)
bottom = i + 1;
if( (work[i] == ',') && (count > get) && (top == 0) )
top = i;
dataS = dataS.substring(bottom,top);
return dataS;
}import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.File;
import java.awt.event.*;
//import java.security.*;
//import sun.security.*;
//import java.awt.Window;
//import com.ms.security.*;
public class Edit extends Applet implements ActionListener, ItemListener
String Gselect;
reader readit;
int mhz, khz;
TextField textField1;
String freq = "000.000";
String data;
Choice freqC;
Button ActivateB, SaveB, /*CancelB, HelpB,*/ DeleteB;
Checkbox SetC;
int NotUsedReply[] = new int[200];
int HwListReply[] = new int[200];
public void init()
readit = new reader();
String myFile="satellite.st1";
// myFile = myFile.concat(Gselect);
File satellite = new File(myFile);
textField1 = new TextField();
textField1.setText( "(void) " );
add( textField1 );
SetC = new Checkbox("TRAP-RX");
add(SetC);
SetC.addItemListener(this);
freqC = new Choice();
freqC.setSize(20,50);
freqC.add("000.000");
add(freqC);
freqC.addItemListener(this);
ActivateB = new Button("Activate");
add(ActivateB);
ActivateB.addActionListener(this);
SaveB = new Button("Save");
add(SaveB);
SaveB.addActionListener(this);
DeleteB = new Button("Delete");
add(DeleteB);
DeleteB.addActionListener(this);
/*CancelB = new Button("Cancel");
add(CancelB);
CancelB.addActionListener(this);
HelpB = new Button("Help");
add(HelpB);
HelpB.addActionListener(this);*/
//textField1.setText( data );
for(int a = 1; a < 9; a++)
data = readit.getData(satellite.getAbsolutePath(), a);//("E:\\forte4j\\system\\Projects\\Zebra\\satellite.st1", a);
freqC.addItem(data);
textField1.setText(satellite.getAbsolutePath() );
public void paint(Graphics g)
//g.drawString("Radio Setup Files",20, 20);
//g.drawString(getParameter("wse"),20, 20);
public void actionPerformed(ActionEvent event)
if(event.getSource() == ActivateB)
activator();
if(event.getSource() == SaveB)
/*if(event.getSource() == CancelB)
stop();
if(event.getSource() == HelpB)
if(event.getSource() == DeleteB)
public void itemStateChanged(ItemEvent e)
if(e.getItemSelectable() == SetC)
textField1.setText("Check box 1 clicked!");
if(e.getItemSelectable() == freqC)
freq = ((Choice)e.getItemSelectable()).getSelectedItem();
public void activator()
makeMHZ();
makeKHZ();
if(mhz > 254)
int StartLink[]={0x0c,0x01,0x07,0x00,0x00,0x00,0x00,0x00,0x00}; //New Link Proc Start
int TrapConfig[]={0x25,0x80,0x00,0x00,0x00,0xb7,0x00,0x0c,0x0b, //TRAP Configuration
0x00,0x00,0x00,0xff,0xa0,0xff,0x0d,0xff,0xe8,
0xff,0x0d,0xff,0x00,0xff,0x15,0xff,0xb0,0xff,
0xff,0xff,0x94,0x0a,0x01,0x06,0x1a,0x00,0x0d,
0x2d,0x21};
TrapConfig[11]=(mhz-255);
TrapConfig[12]=(khz/5);
int SetUserOutput[]={0x41,0x42,0x49,0x54,0x52,0x41,0x50,0x20,0x34, //Sets User Output Format
0x35,0x34,0x35,0x30,0x30,0x2e,0x30,0x4e,0x30,
0x38,0x32,0x34,0x35,0x30,0x30,0x2e,0x30,0x57,
0x30,0x31,0x30,0x30,0x2e,0x30,0x30,0x4b,0x4d,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00};
sendget CmdFunc;
CmdFunc=new sendget();
try
//PolicyEngine.assertPermission(PermissionID.SYSTEM);
Socket h = new Socket("192.9.200.155",9000);
Socket s = new Socket("192.9.200.155",9001);
Socket t = new Socket("192.9.200.155",9002);
int j;
CmdFunc.SendCmd(h,0,0x01,null);
CmdFunc.GetCmd(h,HwListReply);
CmdFunc.SendCmd(s,9,0x1e,StartLink); //New Link Proc Start
CmdFunc.GetCmd(s,NotUsedReply);
CmdFunc.SendCmd(s,37,0x00,TrapConfig); //TRAP Configuration
CmdFunc.GetCmd(s,NotUsedReply);
CmdFunc.SendCmd(s,155,0x03,SetUserOutput);//Sets User Output Format
CmdFunc.GetCmd(s,NotUsedReply);
catch(Exception e){}
else
textField1.setText( "000.000 is the null choice. Try another." );
public void receiveText1( String select )
Gselect=select;
public void makeMHZ()
String y = freqC.getSelectedItem();
y = y.substring(0,3);
mhz = Integer.parseInt(y);
//textField1.setText( y );
public void makeKHZ()
String y = freqC.getSelectedItem();
y = y.substring(4,7);
khz = Integer.parseInt(y);
//textField1.setText( y );
import java.awt.*;
import java.applet.*;
import java.io.RandomAccessFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.LineNumberReader;
import java.awt.event.*;
import com.ms.security.*;
import netscape.security.*;
import netscape.util.*;
public class saver extends Applet implements ActionListener
String nameS = "Data.txt";
String dataS = "Default Data";
Button saveB;
public void init()
saveB = new Button("SaveFile");
add(saveB);
saveB.addActionListener(this);
public void actionPerformed(ActionEvent event)
if(event.getSource() == saveB)
RandomAccessFile RAF;
byte array0[] = dataS.getBytes();
try
if (Class.forName("com.ms.security.PolicyEngine") != null)
PolicyEngine.assertPermission(PermissionID.SYSTEM);
if(Class.forName("netscape.security.PrivilegeManager") != null)
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");
catch (Throwable cnfe)
try
RAF = new RandomAccessFile(nameS, "rw");
// RAF.writeUTF(dataS);
RAF.write(dataS.getBytes());
RAF.close();
catch(Exception e)
public void receiveND(String name, String data)
if(name != null)
nameS = name;
dataS=data;
import java.io.RandomAccessFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.LineNumberReader;
//import java.security.*;
import com.ms.security.*;
import netscape.security.*;
import netscape.util.*;
public class reader
//Signature sig;
public String getData(String filename, int pass)
//String nameS = "Data.txt";
String dataS = "Default Data Sucks";
String comma = ",";
int get = pass, count=0, top=0, bottom=0;
char[] work;
try
if (Class.forName("com.ms.security.PolicyEngine") != null)
PolicyEngine.assertPermission(PermissionID.SYSTEM);
if(Class.forName("netscape.security.PrivilegeManager") != null)
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
catch (Throwable cnfe)
try
//sig.sign();
//nameS = filename;
RandomAccessFile RAF = new RandomAccessFile(filename, "r");
// dataS = RAF.readUTF();
dataS = RAF.readLine();
RAF.close();
catch(Exception e)
return e.toString();
work = dataS.toCharArray();
for(int i = 0; i < dataS.length(); i++)
if( work == ',' )
count++;
if(get == count)
bottom = i + 1;
if( (work == ',') && (count > get) && (top == 0) )
top = i;
dataS = dataS.substring(bottom,top);
return dataS; -
I have a problem with the sync between iTunes and ipad2. I can not see the files in iPad. Help me please.
Cannot see what files ? Music (synced music should appear in the iPod app), films/TV shows (Videos app), documents ... ?
-
Problems with File Transfers Over Firewire 800
Problems with File Transfers Over Firewire 800.
Over the past month, I have had problems when transfering files from my harddrive, over Firewire 800 to a portable drive. I usually transfer very large files (20gb or more) to the portable drives for moving files around. When I drag a file over to copy onto a drive, the transfer starts normally. If I drag more files to copy over, the computer screen goes darker and a large icon comes up that looks like a power button icon. It tells me to restart, so I have to do a hard shut down on my G5. Weird. I also get the dark screen of death sometimes when I am transfering those large files and open another application to do some work while it's copying. It's killing me. I am having to sit here and wait for the transfer to finish before I can do anything.
Any thoughts...
Dual 2.7 GHz PowerPC G5
Mac OSX 10.4.3
Dual 2.7 GHz PowerPC G5 Mac OS X (10.4.3)Have you run the Apple Hardware Test? Sounds like it could be a RAM problem.
-
I have a problem with a pdf file which does not open with reader in windows 8 but it opens properly with adobe pdf reader. All other pdf can be opened in reader.But when i open a pdf(see this link for pdf for which i got error http://incometaxsoft.com/temp/Form.pdf)
it gives error as "Can't open this file. There's a problem with file format".
The same file opens properly in adobe pdf reader.You can check the pdf file which i have mentioned in the link above.But the reader which comes with windows 8 can open some other pdf in the same PC.What may be the error causing this??This has turned out to be an enormous issue for me as I sell PDF files as ebooks. I have done a fair amount of investigating this for my system.
My files have to be compatible not just across readers but across operating systems.
To date, I have over 200 PDFs that have functioned flawlessly across Mac, PC (Windows 7 and below), Android, iPhone/iPad, Linux.
I personally test my PDFs using a variety of readers and PDF editors including
PDF XChange (my favorite)
Foxit (runner up for me and I recommend for most people)
Adobe (the bloated monster)
Nitro 9 (great for moving graphical elements around)
ABBYY
And the Nuance PDF Create toolsets
Those are off the top of my head. There are a bunch on Android that I test with too.
I am running the Windows 10 Pro Tech Preview and I have this same problem so I know it isn't fixed yet in any kind of pre-release way (-sigh-)
Here is what I've learned for my situation
The PDFs I created using NUANCE'S PDF CREATE PROFESSIONAL VERSION 8
all fail using the built-in Windows 8/10 PDF reader.
When I look at the PDF properties for these Nuance created files, the underlying engine used to write them is called "ImageToPDF". Using ABBYY it indicates their own engine as does everyone else that I've tried. It is easy for you to check to see
what created your PDF by doing a "Control D" (look at the document properties). Perhaps there's a common engine causing issues.
If I use the exact same source files to create a PDF using any of my other tools I have no issues. I checked the PDF versions made by the tools and they are all set to 1.5.
A customer mentioned being able to convert them in a way they worked by saving them without having to do any kind of extraction, but I have not been able to duplicate that. Perhaps he did a "print" which seems like it could work.
In summary, the workaround everyone is talking about, using an alternate reader, of course works. But not everyone wants to change.
The culprit I have found is my Nuance PDF Creation tools that are using the ImageToPDF engine.
I hope it gets FIXED as I really don't want to have to regenerate all of my PDF files. -
I suddenly encounter this error message from Fire Fox.
Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that this directory has no read/write restrictions and your hard disk is not full or close to full. It is recommended that you exit the application and fix the problem. If you continue to use this session, you might see incorrect application behaviour when accessing security features.
I uninstalled the browser and download a new version but it does not resolve the issue.
I know my hard disc has ample space. I do NOT know where to find the Profile directory to fix the read restriction box.
== This happened ==
Every time Firefox opened
== After something about security add-on of Norton pop up by itself. ==
== User Agent ==
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; MSN Optimized;US)This link shows things to check - https://support.mozilla.com/kb/Could+not+initialize+the+browser+security+component
-
Is anyone having the same type of problems I'm having with Lion. I have a new MacBook Pro, received 7 weeks ago, preinstalled with Leopard 10.6.7. I didn't migrate anything from my old iMac, wanted a clean install from the Apple Store. While there, I asked for the upgrade to Lion 10.7, however their system was down.
I installed it myself, wirelessly about a week later, and Apple emailed me a receipt. Now, I've had to call support directly last week when I lost Mail, Address Book, was unable to open Preview or iTunes, among other problems. Seemed fixed after a session that baffled even the store tech. Now I am unable to download or install the recent Mac updates for Lion, from the App Store, could not install Adobe Reader, etc. Messages range from 'A network error has occured - Check your Internet connection and try again' to 'The Installer is damaged and cannot open the package. There may be a problem with file ownership or permissions.' All fail and I'll probably have to call Apple again. I am frustrated beyond words. Logs 'Install's runner tool is not properly configured as a setuid tool', domain errors, 'attempt to write a readonly database, and on and on. I have barely done a thing on this computer except search online for help with these problems. Safari gives me a 'You are not connected to the internet' too often. Diagnostics disagrees. I do see wi-fi problems in the forum. Disk and permissions were fine at the beginning of the earlier problems, checked first by support tech. I'm not sure if support tech even knew. I was just happy they were fixed. Anyone have these download and/or install problems after a 'clean bill of health' so to speak, only a week ago?Let's try the following user tip with that one:
"There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows -
Problem with File Based replication in Weblogic Express 10
Hi,
We have Web application (exploded war) file deployed on Weblogic Express 10, to a Cluster of three Managed Servers (all three on different physical machines).
We are using File based session persistance in weblogic.xml
We have a shared location for all the three servers where we will be sharing the Session data.
When we start the application, its works fine and is very fast, but after sometime the application slows down.
Troubleshooting the Issue we found that its a problem with file based replication. By using File based replication every user session is stored in form of directory inside shared directory. So after sometime thousands of directories are created inside the shared directory where the session information is stored. So when we access the application, its waiting for lot of time with Message Session Monitor .... (this is because its browsing through the shared session storage directory for lot of time for session information as it has lot of directories) and finally after a long time like 10 mins we get the Application Home Page.
When we clean up all the saved sessions inside shared directory, the application works fine, But we will see the same sometime later may be after 3 or 4 hours when the shared session directory has lot of session information stored in it.
Is there a way to clean up the saved session information on file system as soon as that user session is closed by using file based replication.
We cannot used Inmemory replication as our Appl doesnt support it.
Please advice as it is a major show stopper in our Production Mirror env.
Weblogic ConsultantIt is possible to reduce number of live session by configuring very low timeout-secs weblogic.xml. Default is 60 minutes.
More details are here..
http://e-docs.bea.com/wls/docs100/webapp/weblogic_xml.html#wp1071982
Jayesh
Yagna Sys -
Hello all,
I am making a simple HttpServlet, which takes input
from html page and saves in to a file, but I'm having a
bit of a problem with file permissions.
I'm getting the following exception
java.security.AccessControlException: access denied (java.io.FilePermission ./data/result read)
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
java.security.AccessController.checkPermission(AccessController.java:427)
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
java.lang.SecurityManager.checkRead(SecurityManager.java:871)
java.io.File.exists(File.java:700)
SyksyHTTPServlet.doPost(SyksyHTTPServlet.java:31)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)The exception seems to occur when I'm trying to check whether the file already
exists or not.
The data directory has all permissions (read, write and execute) set for all users,
and I have made an empty file called result inside the data directory for testing.
This file has read and write permissions enabled for all users.
Here's my code
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.Enumeration;
import java.util.List;
import java.util.ArrayList;
public class SyksyHTTPServlet extends HttpServlet
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
int totalCount = 0;
List list;
String song = request.getParameter("song");
PrintWriter out = response.getWriter();
File file = new File("./data/result");
if(file.exists()) // this is line 31, which seems to cause the exception
list = readFile(file);
else
file.createNewFile();
list = new ArrayList();
list.add(song);
writeFile(file, list);
for(int i = 0 ; i < list.size() ; i++)
out.println(list.get(i));
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost(request, response);
private List readFile(File file)
List list = null;
try
FileInputStream fis = new FileInputStream(file);
ObjectInputStream ois = new ObjectInputStream(fis);
list = (ArrayList)ois.readObject();
ois.close();
catch(Exception e)
e.printStackTrace();
return list;
private void writeFile(File file, List list)
try
FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(list);
oos.flush();
oos.close();
catch(Exception e)
e.printStackTrace();
}I'm using Tomcat 5.5 on Ubuntu Linux, if that has anything to do with this.
I'll appreciate all help.
kari-mattiHello again.
I'm still having problems with this. I made
a simple servlet that reads from and writes
to text file. The reading part work fine on my
computer, but the writing doesn't, not even
an exception is thrown if the file exists that
I'm trying to write to. If I try to create a new
file I'll get an exception about file permissions.
I also asked a friend of mine to try this same
servlet on his windows computer and it works
as it should.
Here's the code
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class ReadServlet extends HttpServlet
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
String s = "";
PrintWriter out = response.getWriter();
String docroot = getServletContext().getRealPath( "/" );
out.println("docroot: "+docroot);
File file = new File(docroot+"test.txt");
if(file.exists())
s = readFile(file);
out.println(s);
else
out.println("file not found");
//file.createNewFile(); // causes exception
//out.println("new file created.");
writeFile(file, "written by servlet");
out.println("Now look in the file "+file.getPath());
out.println("and see if it contains text 'written by servlet'");
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost(request, response);
private String readFile(File file)
FileInputStream fis = null;
BufferedInputStream bis = null;
DataInputStream dis = null;
String s = "";
try
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
s = dis.readLine();
fis.close();
bis.close();
dis.close();
catch(Exception e)
e.printStackTrace();
return s;
private void writeFile(File file, String s)
FileOutputStream fos = null;
BufferedOutputStream bos = null;
DataOutputStream dos = null;
try
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
dos = new DataOutputStream(bos);
dos.writeChars(s);
fos.flush();
bos.flush();
dos.flush();
fos.close();
bos.close();
dos.close();
catch(Exception e)
e.printStackTrace();
}And if someone wants to test this servlet I can
give a war package.
Any advices?
kari-matti
Maybe you are looking for
-
I have had my IPAD2 for quite a while but haven't activated my cellular data for about a year. I am now trying to activate and when I go to cellular data, turn it on and try to tap view account i just get a message that says "connection to server lo
-
Cannot receive calendar invites in iCal
Since upgrading to iOS 7, when my wife (who uses iCloud with an @outlook.com address) sends me a calendar invite, it comes to me (using an @icloud.com address) as an email rather than a notification to my iCal app, on any device. When I accept the ev
-
Forcing Index use with UPPER or LOWER in the WHERE clause.
Does anyone know how to force Oracle to use an index/Key when using UPPER or LOWER in the WHERE clause?
-
2009 MacBook Pro (now MacBook) is not starting up correctly. Taking hours to reach the login screen from the initial power up screen. It is unresponsive while booting up but will eventually reach the login screen if it is left alone for long enough.
-
Capture Audio which can be heard from speakers..
Hi.. I am currently facing a problem in capturing audio which can be heard from the speakers.. i.e. i want to capture audio generated by other applications. Till now I have been successful in capturing audio from microphone using JMF and Java Sound t