Avatar of CCBRONET
CCBRONET
 asked on

Unable to find the file specified

When run the attached java file as a standalone java application within eclipse the programs functions smoothly.....

But when I run it as a Web Application I get the following error....


at org.jpos.iso.packager.GenericPackager.readFile(GenericPackager.java:183)
      at org.jpos.iso.packager.GenericPackager.<init>(GenericPackager.java:110)
      at com.citizen.cbs.businessservices.atm.Server_1$Processor.run(Server_1.java:106)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Nested:java.io.FileNotFoundException: C:\eclipse\basic.xml (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(Unknown Source)
      at java.io.FileInputStream.<init>(Unknown Source)
      at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
      at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
      at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
      at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(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.jpos.iso.packager.GenericPackager.readFile(GenericPackager.java:180)
      at org.jpos.iso.packager.GenericPackager.<init>(GenericPackager.java:110)
      at com.citizen.cbs.businessservices.atm.Server_1$Processor.run(Server_1.java:106)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Nested:java.io.FileNotFoundException: C:\eclipse\basic.xml (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(Unknown Source)
      at java.io.FileInputStream.<init>(Unknown Source)
      at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
      at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
      at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
      at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(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.jpos.iso.packager.GenericPackager.readFile(GenericPackager.java:180)
      at org.jpos.iso.packager.GenericPackager.<init>(GenericPackager.java:110)
      at com.citizen.cbs.businessservices.atm.Server_1$Processor.run(Server_1.java:106)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

Don't know why its trying to search for the basic.xml in C:\eclipse\basic.xml

The basic.xml and the genericpackager.dtd are placed in the root directory of the project....

Thanks In Advance,
Savio Coelho
Server-1.java
Java

Avatar of undefined
Last Comment
CEHJ

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
CEHJ

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
CCBRONET

ASKER
That worked but now I am getting another error for the genericpackager.dtd.....
How do i access this as a resource....



org.jpos.iso.ISOException: java.io.FileNotFoundException: C:\eclipse\genericpackager.dtd (The system cannot find the file specified) (java.io.FileNotFoundException: C:\eclipse\genericpackager.dtd (The system cannot find the file specified))
      at org.jpos.iso.packager.GenericPackager.readFile(GenericPackager.java:202)
      at org.jpos.iso.packager.GenericPackager.<init>(GenericPackager.java:121)
      at com.citizen.cbs.businessservices.atm.Server_1$Processor.run(Server_1.java:96)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Nested:java.io.FileNotFoundException: C:\eclipse\genericpackager.dtd (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(Unknown Source)
      at java.io.FileInputStream.<init>(Unknown Source)
      at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
      at sun.net.www.protocol.file.FileURLConnection.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.jpos.iso.packager.GenericPackager.readFile(GenericPackager.java:199)
      at org.jpos.iso.packager.GenericPackager.<init>(GenericPackager.java:121)
      at com.citizen.cbs.businessservices.atm.Server_1$Processor.run(Server_1.java:96)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Nested:java.io.FileNotFoundException: C:\eclipse\genericpackager.dtd (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(Unknown Source)
      at java.io.FileInputStream.<init>(Unknown Source)
      at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
      at sun.net.www.protocol.file.FileURLConnection.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.jpos.iso.packager.GenericPackager.readFile(GenericPackager.java:199)
      at org.jpos.iso.packager.GenericPackager.<init>(GenericPackager.java:121)
      at com.citizen.cbs.businessservices.atm.Server_1$Processor.run(Server_1.java:96)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
CEHJ

Put the dtd resource where you put the xml one?
CCBRONET

ASKER
Didn't get that???


so far the change made to my code

InputStream xmlFile = getClass().getResourceAsStream("/com/citizen/cbs/businessservices/resources/basic.xml");
				GenericPackager packager = new GenericPackager(xmlFile);
				ISOMsg isoMsg = new ISOMsg();

Open in new window


Both the file are placed in the com.citizen.businessservices.resources package
basic.xml
genericpackager.dtd.txt
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
CEHJ

OK, try putting the dtd in the directory which is the parent directory of  'com'
CCBRONET

ASKER
I just put the DTD declaration internally within the XML file and its working fine.....
CEHJ

Yes, that will do it too
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
CEHJ

:)