• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Web Application in tomcat 7 issue

 
Greenhorn
Posts: 4
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic