aspose file tools*
The moose likes Tomcat and the fly likes Web Application in tomcat 7 issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Web Application in tomcat 7 issue" Watch "Web Application in tomcat 7 issue" New topic
Author

Web Application in tomcat 7 issue

javier cano
Greenhorn

Joined: Dec 28, 2011
Posts: 4

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

Joined: Oct 31, 2011
Posts: 498

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...


PM Me If You Want to get Urgent Help on Java Programming
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18662
    
    8

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

Joined: Dec 28, 2011
Posts: 4

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

Joined: Dec 28, 2011
Posts: 4

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web Application in tomcat 7 issue