Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error - "java.net.SocketException: Connection reset" #31

Open
avikadam opened this issue Sep 27, 2017 · 12 comments
Open

Getting an error - "java.net.SocketException: Connection reset" #31

avikadam opened this issue Sep 27, 2017 · 12 comments

Comments

@avikadam
Copy link

Any clue...

Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.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.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:518)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:970)
at net.sf.flatpack.xml.MapParser.parse(MapParser.java:130)
at net.sf.flatpack.xml.MapParser.parseMap(MapParser.java:276)
at net.sf.flatpack.FixedLengthParser.init(FixedLengthParser.java:110)

@benoitx
Copy link
Contributor

benoitx commented Sep 27, 2017 via email

@avikadam
Copy link
Author

avikadam commented Sep 27, 2017

// It worked fine first time but 2nd onward it's failing. Please find following code. This is from my web application. Somehow it started failing in production. It fails at parser.parse()

    public class FixedLengthFlatpackFileProcessor extends FlatpackFlatFileProcessor {
 protected String mappingFilePath;
 private static Logger logger = Logger.getLogger(FixedLengthFlatpackFileProcessor.class);

/**
 * Construct new {@link FixedLengthFlatpackFileProcessor} using the XML file layout.
 *
 * @param mappingFilePath
 */
public FixedLengthFlatpackFileProcessor(final String mappingFilePath) {
	this.mappingFilePath = mappingFilePath;
}

@Override
public Stream<FlatFileRecord> streamFlatFileRecords(final Parser parser, final FileInterfaceExecution fileExecution){
	return parser.stream().map(record -> this.mapFlatPackRecordToflatFileRecord(fileExecution, record));
}

@Override
public final BuffReaderFixedParser getFlatpackParser(final String filePath){
	try{
		return (BuffReaderFixedParser) BuffReaderParseFactory.getInstance()
		    .newFixedLengthParser(new FileReader(new File(this.mappingFilePath)), new FileReader(new File(filePath)));
	}catch(final FileNotFoundException e){
		FixedLengthFlatpackFileProcessor.logger.error(e.getMessage(), e);
		throw new ResourceNotFoundException(e, "FRM000022", filePath);
	}
}

           public List<ErrorDescriptor> validateFileForStaging(final String filePath){
	final Parser parser = this.getFlatpackParser(filePath);
	final DataSet ds = parser.parse(); //**# Failing here**
       }

 }

@avikadam
Copy link
Author

avikadam commented Sep 27, 2017

//This is the mapping file

<!DOCTYPE PZMAP SYSTEM "http://flatpack.sourceforge.net/flatpack.dtd" >
<PZMAP>
<RECORD id="header" indicator="H" startPosition="1" endPosition="1">
<COLUMN name="RECORD_TYPE_CODE" length="1" />
<COLUMN name="HEADER_ID" length="50" />
<COLUMN name="FILE_CREATION_DATE" length="8" />
</RECORD>
<RECORD id="batchHeader" indicator="B" startPosition="1" endPosition="1">
<COLUMN name="RECORD_TYPE_CODE" length="1" />
<COLUMN name="BATCH_NUMBER" length="50" />
</RECORD>
<COLUMN name="RECORD_TYPE_CODE" length="1" />
<COLUMN name="INVOICE_NUMBER" length="50" />
<COLUMN name="PAYMENT_AMOUNT" length="13" />
<RECORD id="batchTrailer" indicator="A" startPosition="1" endPosition="1">
<COLUMN name="RECORD_TYPE_CODE" length="1" />
<COLUMN name="BATCH_NUMBER" length="50" />
<COLUMN name="RECORD_COUNT" length="10" />
</RECORD>
<RECORD id="trailer" indicator="T" startPosition="1" endPosition="1">
<COLUMN name="RECORD_TYPE_CODE" length="1" />
<COLUMN name="RECORD_COUNT" length="10" />
</RECORD>
</PZMAP>

@benoitx
Copy link
Contributor

benoitx commented Sep 27, 2017 via email

@avikadam
Copy link
Author

Yes but looks like Sourceforge.net is down

@avikadam
Copy link
Author

what i need to do in this case

@benoitx
Copy link
Contributor

benoitx commented Sep 27, 2017 via email

@avikadam
Copy link
Author

avikadam commented Sep 27, 2017

Thanks Man for replying so promptly i appreciate it.

Yes, i did confirmed, this is the problem. I tried with local dtd location, it works. Sometime these remote or dtds located at other server makes problem in case they stops supporting or goes down.

@benoitx
Copy link
Contributor

benoitx commented Sep 27, 2017 via email

@avikadam
Copy link
Author

Sounds good. Will post details and observations.

Thanks

@benoitx
Copy link
Contributor

benoitx commented Sep 27, 2017 via email

@martindiphoorn
Copy link
Collaborator

Wondering if this is still an issue when we have dropped JDOM in #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants