• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web Application in tomcat 7 issue

 
javier cano
Greenhorn
Posts: 4
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i have a problem with my application when it is loaded in tomcat 7. I developed a web application with JSP and Spring MVC in eclipse. When i run the application in eclipse it works perfectly but when i loaded the war file in tomcat 7 and when the application has to print a ticket it doesn't, and it doesn't throw a error. Its the only functional error but when i run it in eclipse the ticket was printed. Thanks in advance
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couldn't help with that information. You need to describe the problem in more details, i.e how the print ticket works, post the related code...
 
Paul Clapham
Sheriff
Pie
Posts: 20746
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could this possibly have something to do with the printer being on the same system as your Eclipse environment but not on the same system as your Tomcat environment.

But that's just a wild guess -- like Nam Ha Minh says, we need more details.
 
javier cano
Greenhorn
Posts: 4
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry im new in this forum. The printer is a usb thermal printer EC 5890X. Let me explain better. I think that the problem is something between tomcat and the war file becouse when i ran the application in the same version of tomcat (tomcat 7) the application prints the ticket, but when the war file is loaded in tomcat the ticket does not print and there werent any error or message that reveals a issue.

My code for print is:

i crated the ticket in an array of strings, then i create a file with the array of strings (the ticket) and later i print the file in the next method:

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 dont know if in tomcat the application has privileges to create a file maybe that is the problem.
 
javier cano
Greenhorn
Posts: 4
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
thanks for the help anyway
greetings from Mexico
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic