Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in running exec() from servlet

 
shashank bezalwar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , I am using exec() to run external exe from servlet. The exe is a program which converts the Framemaker files having .mif extension to pdf for that it needs the Framemaker running. My problem is i am able to execute the exe but the exe cannot connect to Framemaker. when i execute from eclipse it connects to Framemeker but from Servlet it does not connect. I also tried using exec("cmd /c mif2pdf.exe") but still i have the same problem. can anybody please tell me how to do it.
thanks in advance
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what "connect to Framemaker" means
 
shashank bezalwar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
connect to Framemaker means it uses the framemaker server to convert the mif files to pdf format. without Framemaker running it cannot convert the file.
 
shashank bezalwar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my code
Runtime rt = Runtime.getRuntime() ;
Process p = rt.exec("c:\\mifpdf\\MIF2PDF Quag033 C:\\mifpdf\\MicroSeqFastFungalPrtcl_Title.mif");
in this MIF2PDF is the exe file which accepts two parameters 1st parameter is the name of the machine where framemaker is running in this case its my local machine Quag033 and the 2nd parameter is the full path of the MIF file.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you run it in the servlet, is that also on your local machine?
 
shashank bezalwar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes the servlet is on my local machine. i am using the servlet in web application which has its own tomcat.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which version of Tomcat are you using, and are you using the default permissions?
 
shashank bezalwar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using Tomcat 5.5 and i am using it with default permissions.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also, have you checked the logs for errors?
 
shashank bezalwar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yep it gives null pointer exception.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shashank bezalwar:
yep it gives null pointer exception.


If it's throwing a NullPointerException, it should also be logging the line number where the exception occurs. That should give you a good starting point for debugging.
 
shashank bezalwar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
forgot to tell you there is no log in tomcat the null pointer exception error is given is my web applications log.
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IF its throwing NPE than theres some problem in your servlet.
not in your EXE. may be exe doesnt execute at all.

can you post the exception stacktrace?
 
shashank bezalwar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am sure that the exe is executing because if i give only file name it prompts me to give full path of file.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shashank bezalwar,
Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see: TellTheDetails.

Telling us that your application is throwing a NullPointerException but not posting the line of code where it's occurring or, at least, posting the stack trace (as you've already been asked to do) so that we can ask you what's on line xxx makes it virtually impossible for us to help you.

Put yourself in our shoes. How would you help someone who asks you what's wrong with a program if it's throwing a NullPointerException?

Try to give us as much relevant information as possible, including code snippets and stack traces.

-Ben
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic