JNDIポートを変更するとEclipseでJBossをシャットダウンする際の問題
-
05-07-2019 - |
質問
第1フェーズ
変更したため、Eclipseで実行中のJBossインスタンスのシャットダウンに問題があります JBossのJNDIポート。もちろん、コンソールビューからはシャットダウンできますが、 停止ボタン(デフォルトの1099ポートでJNDIポートを検索します)。見ている すべてのソリューションに転送します。ありがとうございました!
使用環境:
- JBoss 4.0.2( default を使用)
- Eclipse 3.4.0。 (JBoss Tools 2.1.1.GAを使用)
デフォルトのポート:1098、1099 変更されたポート:11098、11099
jbosspath / server / default / conf / jboss-service.xmlの次の部分を変更しました:
<!-- ==================================================================== -->
<!-- JNDI -->
<!-- ==================================================================== -->
<mbean code="org.jboss.naming.NamingService"
name="jboss:service=Naming"
xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
<!-- The call by value mode. true if all lookups are unmarshalled using
the caller's TCL, false if in VM lookups return the value by reference.
-->
<attribute name="CallByValue">false</attribute>
<!-- The listening port for the bootstrap JNP service. Set this to -1
to run the NamingService without the JNP invoker listening port.
-->
<attribute name="Port">11099</attribute>
<!-- The bootstrap JNP server bind address. This also sets the default
RMI service bind address. Empty == all addresses
-->
<attribute name="BindAddress">${jboss.bind.address}</attribute>
<!-- The port of the RMI naming service, 0 == anonymous -->
<attribute name="RmiPort">11098</attribute>
<!-- The RMI service bind address. Empty == all addresses
-->
<attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
<!-- The thread pool service used to control the bootstrap lookups -->
<depends optional-attribute-name="LookupPool"
proxy-type="attribute">jboss.system:service=ThreadPool</depends>
</mbean>
<mbean code="org.jboss.naming.JNDIView"
name="jboss:service=JNDIView"
xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml">
</mbean>
Eclipseのセットアップ:
JBoss Toolsの設定について: 以前のバージョンがあり、この問題が発生しました。JbossToolsのバグ修正について読んだので、2.1.1.GAに更新しました。これでボタンが変更され、新しい設定ビューが表示されましたが、何も変更できません...同様に異常であるようです:
エラーダイアログ:
スタックトレース:
javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at org.jboss.Shutdown.main(Shutdown.java:202)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:254)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:228)
... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.<init>(Socket.java:309)
at java.net.Socket.<init>(Socket.java:211)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:69)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)
... 5 more
Exception in thread "main"
第2段階:
File / new / other / serverに新しいサーバーを作成した後、設定タブに表示されました。停止ボタンは機能します(サーバーはjndiポートを追加変更せずにシャットダウンメッセージを受信します-今はチャンスがありません)が、エラーメッセージがスローされますが、例外ではありますが、例外はありません。スタックトレース:&quot;サーバーJBoss 4.0サーバーの停止に失敗しました。&quot;
解決
OK、あなたがしなければならないことは、File-&gt; New-&gt; Other-&gt; Serverであり、そこでJBossサーバーをセットアップします。その後、Preferences-&gt; JBossTools-&gt; Serversに表示されます。
複雑です。
他のヒント
この問題の詳細な修正は次のとおりです。 jndiポートが再マップされると、Eclipse WTPサーバーコネクタはJBossをシャットダウンしません。
これは、デフォルトのサーバーコネクタプロファイルがjndiPortに対して独自のエイリアスを使用しないためです。この問題はeclipse.orgでも議論されています。 http://www.eclipse.org/forums/ index.php?t = msg&amp; goto = 489439&amp; S = 0db4920aab0a501c80a626edff84c17d#msg_489439
解決策は、eclipseの.serverdefファイルにあります:
<eclipse>\plugins\org.eclipse.jst.server.generic.jboss_1.5.105.v200709061325\servers\jboss*.serverdef
jndiポートのxmlプロパティを宣言します:
<property id="jndiPort"
label="%jndiPort"
type="string"
context="server"
default="1099" />
これは、serverdefにSTOPコマンドがコーディングされている場合にのみ使用する必要があります。
だからこれ:
<stop>
<mainClass>org.jboss.Shutdown</mainClass>
<workingDirectory>${serverRootDirectory}/bin</workingDirectory>
<programArguments>-S</programArguments>
<vmParameters></vmParameters>
<classpathReference>jboss</classpathReference>
</stop>
これになります:
<stop>
<mainClass>org.jboss.Shutdown</mainClass>
<workingDirectory>${serverRootDirectory}/bin</workingDirectory>
<programArguments>-s jnp://${serverAddress}:${jndiPort}</programArguments>
<vmParameters></vmParameters>
<classpathReference>jboss</classpathReference>
</stop>
このための哲学は、jndi接続の定義と比較することで確認できます。
<jndiConnection>
<providerUrl>jnp://${serverAddress}:${jndiPort}</providerUrl>
<initialContextFactory>org.jnp.interfaces.NamingContextFactory</initialContextFactory>
<jndiProperty>
<name></name>
<value></value>
</jndiProperty>
</jndiConnection>
この一般的なケース修正のインスピレーションに対するクレジットは、Moisa Laurentiu Florinに送られます。ハードコードされた値ではなく、$ {jndiPort}に置き換える方法を探すようになったのは、彼らの貢献でした。
この修正により、両方のプレーンなEclipse WTPサーバーコネクタが修正されます。私はまだJBOss IDEコネクタを調査しています
jboss-path \ bin \ shutdown.jarを開きます
例:jboss-4.2.3.GA \ bin \ shutdown.jar
およびjboss-path \ bin \ shutdown.jar \ jndi.propertiesを開きます
変更
java.naming.provider.url = jnp:// localhost:1099からjava.naming.provider.url = jnp:// localhost:11099へ
MyEclipseサーバー構成では、「オプションのシャットダウン引数」フィールドがあり、デフォルト値が入力されています
--shutdown
変更して
-s jnp://localhost:11099 --shutdown
編集済み:
申し訳ありませんが、この回答はMyEclipseに関連しています。ただし、ご使用の環境でもJBossシャットダウンコマンドを指定できる場所が必要です。 たぶん、「実行...」を見てみましょう。構成?
ファイルで変更する必要があります&quot; /home/fmoisa/workspace/eclipse/plugins/org.eclipse.jst.server.generic.jboss_1.5.206.v20090115/servers/jboss42.serverdef"これ:
org.jboss.Shutdown $ {serverRootDirectory} / bin -S -Djboss.boot.loader.name = shutdown.bat jboss.shutdown
これ:
org.jboss.Shutdown $ {serverRootDirectory} / bin -S -sjnp:// localhost:11099 -Djboss.boot.loader.name = shutdown.bat jboss.shutdown
gl all;)
Eclipse WTPからデフォルトで提供されるものではなく、JBossツールが提供するサーバーアダプターを使用します。
その後、サーバーをダブルクリックするだけで、JNDIポートを編集できます(何もしなければ、XML構成から自動的に選択されます)。また、起動構成のコマンドライン引数を介してJNDIポートを設定するトリックを行うこともできますが、それは単にポート値を設定するよりも面倒です。
これはJBoss 6.0.0M3で変更されました。
停止コマンドは次のとおりです。
&quot;-s service:jmx:rmi:/// jndi / rmi:// localhost:1090 / jmxrmi&quot;
ポートも変更されていることに注意してください。 1099ではJNDIポートではなくなりました。ただし、 RMI / JMXポート1090 です。そのため、サーバー定義に別の構成パラメーターが必要になります。
「JNDIポート」がJBoss 6.0.0M3サーバーにはパラメーターが必要です。
http://www.csに変更されたEclipseプラグインがあります。 hs-rm.de/~knauf/public/ には、この変更を含む6.0.0M3のサーバー定義が含まれています。このサイトは、この変更の詳細を含むJBossフォーラムスレッドにもリンクしています。
よろしく
ウォルフガング・クナウフ