Running cgi-bin on Tomcat: Simple steps & gotchas実行中のcgi - binにはTomcat :簡単な手順を実行&雑多な事柄
cgi-bin programs (common executables) can be run from Tomcat. cgi - binにプログラム(共通の実行可能ファイル)から起動できます。 Tomcatのです。 It is however not enabled by default.しかしこれはデフォルトでは有効になっています。
To enable it carefully follow the steps below:有効にするには慎重に次の手順に従ってください:
1. 1 。 Uncomment (or add) the following sections to $CATALINA_HOME/conf/web.xml (%CATALINA_HOME%\conf\web.xml on windows), between theアンコメント(または追加)は、次のセクションをの$ CATALINA_HOME / conf / web.xmlの( % CATALINA_HOMEに対する% \会\ web.xmlのWindows上で) 、の間に
2. 2 。 Rename the $CATALINA_HOME/server/lib/servlets-cgi.renametojar (%CATALINA_HOME%\server\lib\servlets-cgi.renametojar on windows) file to $CATALINA_HOME/server/lib/servlets-cgi.jar (%CATALINA_HOME%\server\lib\servlets-cgi.jar on windows)の名前を変更するの$ CATALINA_HOME /サーバー/ libに/サーブレット- cgi.renametojar ( % CATALINA_HOMEに対する% \サーバー\ lib \ディレクトリサーブレット- cgi.renametojarをWindows )にファイルをの$ CATALINA_HOME /サーバー/ libに/サーブレット- cgi.jar ( % CATALINA_HOMEに対する% \サーバー\ lib \ディレクトリサーブレット- cgi.jar Windows上で)
3. 3 。 Restart Tomcat Tomcatを再起動する
Testing with Hello.bat テストをhello.bat
A simple way to test would be to create a cgi directory under WEB-INF directory of your Web application.する簡単な方法をテストするCGIのディレクトリを作成するにはWEB - INFディレクトリの下のウェブアプリケーションを作成します。
Lets add a simple file called hello.bat (for windows users).では、単純なファイルを追加すると呼ばれるhello.bat ( Windowsユーザ) 。
The file contains just the line:ファイルに含まだけの行:
echo Hello World!世界エコーハロー!
This displays the String “Hello World!”この表示される文字列は" Hello World ! "
Create a file called env.bat env.batと呼ばれるファイルを作成する
The file contains just the line:ファイルに含まだけの行:
set セットする
This displays all the available environment variables for the cgi-bin program.このディスプレイのすべての利用可能な環境変数をcgi - binにプログラムです。
Gotchas on windows雑多な事柄をWindows
—————— ------
Normally we use @echo off in a batch file to turn off displaying the command.通常、私たちの使用@エコーオフにするバッチファイルを無効にするに表示してコマンドを実行します。 However when we do the following, no output is displayed:しかし私たちは、次のときに、何も出力が表示されます:
@echo off @エコーオフ
echo Hello World!世界エコーハロー!
It just needs a newline to be happy.これだけの要求には、改行の幸せです。 So create a file (say empty.txt) which just contains a newline.これを作成するファイル(言ってやるがempty.txt )をわずかには、改行してください。 Then change hello.bat to the following: hello.batを変更して以下の通りです:
@echo off @エコーオフ
type empty.txtタイプempty.txt
echo Hello World!世界エコーハロー!
echo onエコー上
This works as intended.この作品として意図します。
Note: Would you like to show a注:表示するように token of appreciationトークンの感謝 for my hard work?私のハードワークですか? I enjoy a cup of私の一杯を楽しむ Cafe Estima Blendカフェエスティマブレンド from Starbucks.スターバックスからです。
Filed under提出されて Headline Newsニュースの見出し , 、 How Toどのように , 、 Java Software Javaソフトウェア | |
| |
RSS 2.0 RSS 2.0を | |
Email this Article電子メールこの記事
You may also like to readを読むようにすることも可能 |




April 23rd, 2004 at 1:07 pm 2004年4月23日は1:07 pmの
Don’t forget to uncomment the servlet-mapping for cgiサーブレットのコメントを外しても忘れずにマッピングをCGIで
December 11th, 2004 at 2:11 pm 2004年12月11日は2:11 pmの
I did at the bottom.私はの下部にします。
March 25th, 2005 at 1:58 pm 2005年3月25日1:58 pmの
I had to specify an executable init param equal to the full path of perl in order to get this to work.私は実行可能ファイルを指定するに等しいのinit paramのPerlのフルパスを得るために、この作業です。
executable実行可能ファイル
full path of perl Perlのフルパスを指定
I am not sure why I had to do this since perl should already be in the path.私はなぜか分からないので私はこれを行うにはPerlのは既には、パスを入力します。 I’m running TomCat 5 on Windows XP Professional.私はTomcat 5の実行中にWindows XP Professionalのです。
April 4th, 2005 at 3:14 pm 2005年4月4日は3:14 pmの
@Giles Specifying full-path looks logical to me. @ジャイルズは論理的にフルパスで指定するよ。 Java doesn’t invoke executables by looking at the path variable. Javaの実行可能ファイルが起動されない変数のパスを見てください。
May 6th, 2005 at 1:43 am 2005年5月6日は1:43アム
Add追加する
executable実行可能ファイル
or (windows xp)または( Windows XPの場合)
executable実行可能ファイル
cmd /c cmd /
May 6th, 2005 at 1:47 am 2005年5月6日の午前5:17
add追加する
param-name=executableパラメータ名=実行可能
value=値=
or (windows xp)または( Windows XPの場合)
param-name=executableパラメータ名=実行可能
value=cmd /c値= cmd /
May 6th, 2005 at 1:49 am 2005年5月6日1:49アム
Directly add executables including batch files.バッチファイルの実行可能ファイルを含む直接追加します。
However if your want to execute cmd commands like dir then you will have to use cmd /c dir.しかし、もしあなたのcmdコマンドを実行するようにしたいディレクトリを使用する必要があります。入力し、 cmd / DIRを指定します。
October 4th, 2005 at 5:04 am 2005年10月4日は5:04アム
December 2nd, 2005 at 4:55 am 2005年12月2日は4:55アム
hi all.can anybody help me to send and receive mail from my localhost.im using tomcat5 as my localserver.plz help me out..thanks to allこんにちはall.can手伝って誰からのメールを送受信するtomcat5として使用してマイマイlocalhost.im localserver.plzすべてのおかげで私を助けて..
December 2nd, 2005 at 7:24 am 2005年12月2日の午前7時24時
Hi Rock,ハワイ岩、
Please refer to this article -この記事を参照してください-
How to Send / Receive Emails (SMTP & POP) From Localhost; Simple Freeware MailServerどのように送信/受信メール( smtp及びpop )よりlocalhostの;単純なフリーウェアのメールサーバ
It has been written to address your question.書面に対処することがあなたの質問です。
Best,最高の、
AngsumanのAngsuman
December 15th, 2005 at 10:14 am 2005年12月15日10:14アム
Please, what is the URL that I shoul enter in order to get the cgi executed?お願い、私は何ですshoulのURLを入力して実行するために入手してCGIのですか?
Does the url below shouldn’t work?下記URLは、仕事はないですか? it isn’t.そうではありません。
http:localhost:8080//cgi-bin/foo.sh
thanksありがとう
Breno Leitão breno leitão
December 15th, 2005 at 11:44 am 2005年12月15日11:44アム
Try:試し:
http://localhost:8080/Your http://localhost:8080/your web application directory]/cgi-bin/foo.sh Webアプリケーションディレクトリ] / cgi-bin/foo.sh
Please closely follow the instructions above.密接に上記の手順に従ってください。
April 20th, 2006 at 12:42 pm 2006年4月20日は12:42 pmの
I have been trying to put perl scripts in webapps/ROOT/WEB-INF/cgi-bin:私はPerlスクリプトにしようとして置くwebappsかを/ root / WEB - INFの/ cgi - binに:
A) printEnv.cgi 1 ) printenv.cgi
#!/usr/bin/perl # ! / usr / binに/ perlを
print “Content-type: text/html\n\n”;印刷する"コンテンツタイプ:テキスト/ HTMLの\ n \ n " ;
print “\n”;プリント" \ n " ;
foreach $key (sort keys(%ENV)) { foreach $キー(並べ替えキー( %環境) ) (
print “$key = $ENV{$key}”;印刷" $キー= $環境( $キー) " ;
} )
B) Changes to web.xmlイ)の変更をweb.xmlの
cgi CGIの
org.apache.catalina.servlets.CGIServlet org.apache.catalina.servlets.cgiservlet
executable実行可能ファイル
/usr/bin/perl / usr / binに/ perlを
clientInputTimeout clientinputtimeout
100
debugデバッグ
6
cgiPathPrefix cgipathprefix
WEB-INF/cgi-bin web-inf/cgi-bin
5
cgi CGIの
/cgi-bin/* / cgi - binに/ *
D) Renamed to servlets-cgi.jar奥行)名前をサーブレット- cgi.jar
E) Restarted serverメール)サーバーの再起動
But when I do:しかし、私は:
http://mydomain/cgi-bin/printEnv.cgi http://mydomain/cgi-bin/printenv.cgi
it does not go to the URLのURLに行くことはありません
April 28th, 2006 at 12:24 pm 2006年4月28日12:24 pmの
The steps have worked perfectly for many including myself.多くの手順を実行私も含めて完全に働いた。
Unfortunately I don’t have time at this moment to support your specific issue.残念ながら、私が時間がない現時点では特定の問題をサポートしています。
April 25th, 2007 at 1:47 pm 2007年4月25日は1:47 pmの
Hi,やあ、
I followed the steps but I cannot start bat file as cgi script on WinXP.私の後の手順を実行することはできませんしかし、私としてスタート]ボタンをbatファイルCGIスクリプトをWinXPなど。 The error is: “java.io.IOException: Cannot run program “perl” (in directory “C:\Program Files\Tomcat 5.5\webapps\test\WEB-INF\cgi”)このエラーは: "投げたjava.io.IOException :プログラムを実行することはできません" Perlの" (ディレクトリ" c : \プログラムファイル\のTomcat 5.5 \ webappsか\テスト\ WEB - INFの\のCGI " )
I tried to addみましたを追加する
param-name=executableパラメータ名=実行可能
value=cmd /c値= cmd /
or param-name=executableまたはパラメータ名=実行可能
value=cmd値= cmd
but without success.しかし、成功です。 Any ideas?何かお考えですか?
October 19th, 2007 at 3:37 am 2007年10月19日は3:37アム
test.cgi is : test.cgiは:
#!\perl\bin\perl.exe# ! \ Perlの\ binに\ perl.exeprint “Content-type: text/html\n\n”;印刷する"コンテンツタイプ:テキスト/ HTMLの\ n \ n " ;
print “IN TEST!\n”;印刷"のテスト! \ n " ;
print “\n”;プリント" \ n " ;
print “IN TEST!\n”;印刷"のテスト! \ n " ;
print “\n”;プリント" \ n " ;
Store Location of test.cgi is : webapps/test/店の場所をtest.cgiは: webappsか/テスト/
Output in出力さ http://localhost:8080/test/test.cgi http://localhost:8080/test/test.cgi
#!\perl\bin\perl.exe print “Content-type: text/html\n\n”; print “\n”; print “\n”; print “# ! \ Perlの\ binに\ perl.exeを印刷する"コンテンツタイプ:テキスト/ HTMLの\ n \ n " ;印刷" \ n " ;印刷" \ n " ;印刷"IN TEST!のテスト!\n”; print “\n”;\ n " ;印刷" \ n " ;October 19th, 2007 at 3:48 am 2007年10月19日は3:48アム
Please help me to fix the working of CGI which I mentioned above.助けてください作業のCGIを修正して、上記の私です。 I am not able to execute ang CGI through TOMCAT.私のCGI経由のを実行することはできませんTomcatのです。