I developed a web application with JSP and Spring MVC in eclipse. When i run the application in eclipse works perfectly but when i loaded the war file in tomcat 7 when the application has to print a ticket it doesn’t, and it doesn’t throw a error. the next log is from localhost access
> 127.0.0.1 - - [23/Jul/2012:11:41:29 -0600] "GET /LilyStore/ HTTP/1.1" 200 2866
> 127.0.0.1 - - [23/Jul/2012:11:41:29 -0600] "GET /LilyStore/Css//LiliStyle.css HTTP/1.1" 304 -
> 127.0.0.1 - - [23/Jul/2012:11:41:29 -0600] "GET /LilyStore/JS//funciones.js HTTP/1.1" 304 -
> 127.0.0.1 - - [23/Jul/2012:11:41:33 -0600] "POST /LilyStore/forms/validateLogin.html?parametro=jav¶m2=123 HTTP/1.1"
> 200 6606
> 127.0.0.1 - - [23/Jul/2012:11:41:33 -0600] "GET /LilyStore//Css//LiliStyle.css HTTP/1.1" 304 -
> 127.0.0.1 - - [23/Jul/2012:11:41:33 -0600] "GET /LilyStore//JS//funciones.js HTTP/1.1" 304 -
> 127.0.0.1 - - [23/Jul/2012:11:41:38 -0600] "GET /LilyStore/forms/showVentasPorRango HTTP/1.1" 200 9581
> 127.0.0.1 - - [23/Jul/2012:11:41:38 -0600] "GET /LilyStore//JS//calendar_eu.js HTTP/1.1" 304 -
> 127.0.0.1 - - [23/Jul/2012:11:41:39 -0600] "GET /LilyStore/forms/makeCorte.html HTTP/1.1" 200 9581
Catalina log its ok without errors the next part is the final lines of catalina log.jul
23, 2012 11:41:10 AM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/showVentasPorRangoMostrar.*] onto handler 'ventasControllerImpl'
jul 23, 2012 11:41:10 AM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/showVentasPorRangoMostrar/] onto handler 'ventasControllerImpl'
jul 23, 2012 11:41:10 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization completed in 5980 ms
jul 23, 2012 11:41:10 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\docs
jul 23, 2012 11:41:10 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\manager
jul 23, 2012 11:41:10 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT
jul 23, 2012 11:41:10 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
jul 23, 2012 11:41:10 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
jul 23, 2012 11:41:10 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 9738 ms
jul 23, 2012 11:52:47 AM org.apache.jasper.compiler.TldLocationsCache tldScanJar
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
In the program a file is created to print it. the method who print that file is as follows:
public void imprimir(String ticketName){
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
//use the default printer
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
if (service != null) {
try {
//create a print job
DocPrintJob job = service.createPrintJob();
//attributes of the job
DocAttributeSet das = new HashDocAttributeSet();
FileInputStream fis = new FileInputStream(ticket+".txt");
Doc doc = new SimpleDoc(fis,flavor,das);
try {
//the job is send it to the printer
job.print(doc,null);
}
catch(Exception e){
e.printStackTrace();
}
}
catch(Exception e){
e.printStackTrace();
}
}
}
I’ve found the problem it was the path of the file to print, tomcat creates the file in the root of the folder when my application print in the path of the warfile