• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

problem in running exec() from servlet

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also, have you checked the logs for errors?
 
shashank bezalwar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yep it gives null pointer exception.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic