質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.30%
Jakarta EE

Jakarta EEは、サーバーサイドで用いるJavaのフレームワークであり、Java EEの後継技術です。Javaプラットフォームの標準仕様には、Java SE/Jakarta EE/Java MEの3つがあり、Jakarta EEはエンタープライズ分野におけるニーズに対応しています。

JBoss Application Server

JBoss Application Server (JBoss AS)はフリーソフトウェア・オープンソースであるJava EEをベースとした、クロスプラットフォームアプリケーションサーバーです。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

Q&A

0回答

128閲覧

WildFly33にデプロイしたEJB3モジュールに別のサーバからアクセスしようとする際のSASLのエラーを解決したい

katatema01

総合スコア23

Jakarta EE

Jakarta EEは、サーバーサイドで用いるJavaのフレームワークであり、Java EEの後継技術です。Javaプラットフォームの標準仕様には、Java SE/Jakarta EE/Java MEの3つがあり、Jakarta EEはエンタープライズ分野におけるニーズに対応しています。

JBoss Application Server

JBoss Application Server (JBoss AS)はフリーソフトウェア・オープンソースであるJava EEをベースとした、クロスプラットフォームアプリケーションサーバーです。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

0グッド

0クリップ

投稿2025/04/09 08:57

実現したいこと

dockerで稼働中のWildFly33にEJB3モジュールをデプロイしています。
これに対して、コンテナ外のローカルで作成したSpringBootアプリケーションから、EJBのStatelessBeanをリモートで利用したいです。

発生している問題・分からないこと

dockerコンテナへのデプロイは成功しているみたいですが、
SpringBootからアクセスしようとした際に

Caused by: java.io.FileNotFoundException: \opt\bitnami\wildfly\standalone\tmp\auth\local9188169052057128693.challenge (指定されたパスが見つかりません。)

が出力されます。

実行環境のOSは、windows11。
docker-desktopで試しています。

実際のコードは以下になります。
https://github.com/katatema/EJBSampleServer

エラーメッセージ

error

1Whitelabel Error Page 2This application has no explicit mapping for /error, so you are seeing this as a fallback. 3 4Wed Apr 09 17:29:44 JST 2025 5There was an unexpected error (type=Internal Server Error, status=500). 6EJBCLIENT000409: No more destinations are available 7org.jboss.ejb.client.RequestSendFailedException: EJBCLIENT000409: No more destinations are available 8 at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:620) 9 at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:551) 10 at org.jboss.ejb.protocol.remote.RemotingEJBClientInterceptor.handleInvocationResult(RemotingEJBClientInterceptor.java:57) 11 (中略) 12 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743) 13 at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) 14 at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190) 15 at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) 16 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) 17 at java.base/java.lang.Thread.run(Thread.java:833) 18 Suppressed: org.jboss.ejb.client.RequestSendFailedException: Error in connecting to Destination @remote+http://127.0.0.1:8080 : Please check if the client and server are configured to use the same protocol and ports. 19 at org.jboss.ejb.protocol.remote.RemoteEJBReceiver$1.handleFailed(RemoteEJBReceiver.java:112) 20 at org.jboss.ejb.protocol.remote.RemoteEJBReceiver$1.handleFailed(RemoteEJBReceiver.java:78) 21 at org.xnio.IoFuture$HandlingNotifier.notify(IoFuture.java:215) 22 at org.xnio.AbstractIoFuture$NotifierRunnable.run(AbstractIoFuture.java:720) 23 (中略) 24 at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) 25 at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) 26 at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89) 27 at org.xnio.nio.WorkerThread.run(WorkerThread.java:603) 28 Caused by: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed: 29 JBOSS-LOCAL-USER: javax.security.sasl.SaslException: ELY05128: Failed to read challenge file [Caused by java.io.FileNotFoundException: \opt\bitnami\wildfly\standalone\tmp\auth\local9188169052057128693.challenge (指定されたパスが見つかりません。)] 30 DIGEST-MD5: javax.security.sasl.SaslException: DIGEST-MD5: Server rejected authentication 31 at org.jboss.remoting3.remote.ClientConnectionOpenListener.allMechanismsFailed(ClientConnectionOpenListener.java:109) 32 at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:401) 33 (中略) 34 at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190) 35 at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) 36 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) 37 at java.base/java.lang.Thread.run(Thread.java:833) 38 Suppressed: javax.security.sasl.SaslException: ELY05128: Failed to read challenge file [Caused by java.io.FileNotFoundException: \opt\bitnami\wildfly\standalone\tmp\auth\local9188169052057128693.challenge (指定されたパスが見つかりません。)] 39 at org.wildfly.security.sasl.localuser.LocalUserClient.evaluateMessage(LocalUserClient.java:108) 40 at org.wildfly.security.sasl.util.AbstractSaslParticipant.evaluateMessage(AbstractSaslParticipant.java:206) 41 (中略) 42 at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) 43 at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282) 44 ... 1 more 45 Caused by: java.io.FileNotFoundException: \opt\bitnami\wildfly\standalone\tmp\auth\local9188169052057128693.challenge (指定されたパスが見つかりません。) 46 at java.base/java.io.FileInputStream.open0(Native Method) 47 at java.base/java.io.FileInputStream.open(FileInputStream.java:216) 48 at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157) 49 at org.wildfly.security.sasl.localuser.LocalUserClient.evaluateMessage(LocalUserClient.java:94) 50 ... 14 more 51 Suppressed: javax.security.sasl.SaslException: DIGEST-MD5: Server rejected authentication 52 at org.jboss.remoting3.remote.ClientConnectionOpenListener$Authentication.handleEvent(ClientConnectionOpenListener.java:760) 53 at org.jboss.remoting3.remote.ClientConnectionOpenListener$Authentication.handleEvent(ClientConnectionOpenListener.java:602) 54 at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) 55 at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) 56 at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89) 57 at org.xnio.nio.WorkerThread.run(WorkerThread.java:603) 58

該当のソースコード

Java

1package com.example; 2 3import jakarta.ejb.Remote; 4import jakarta.ejb.Stateless; 5 6@Stateless 7@Remote(SampleService.class) 8public class SampleServiceBean { 9 public String sayHello(String name) { 10 return "Hello " + name; 11 } 12}

Java

1package com.example; 2 3public interface SampleService { 4 String sayHello(String name); 5} 6

Java

1package com.example.demo.controller; 2 3import java.util.Properties; 4import java.util.concurrent.Callable; 5 6import javax.naming.Context; 7import javax.naming.InitialContext; 8 9import org.springframework.stereotype.Controller; 10import org.springframework.web.servlet.ModelAndView; 11import org.wildfly.security.auth.client.AuthenticationConfiguration; 12import org.wildfly.security.auth.client.AuthenticationContext; 13import org.wildfly.security.auth.client.MatchRule; 14 15import com.example.SampleService; 16 17import org.springframework.web.bind.annotation.GetMapping; 18 19@Controller 20public class MainController { 21 @GetMapping("/") 22 public ModelAndView index(ModelAndView mav) throws Throwable { 23 mav.setViewName("main/index"); 24 // Create the authentication configuration 25 AuthenticationConfiguration ejbConfig = AuthenticationConfiguration.empty().useName("admin").usePassword("adminadmin"); 26 // Create the authentication context 27 AuthenticationContext context = AuthenticationContext.empty().with(MatchRule.ALL.matchHost("127.0.0.1"), ejbConfig); 28 29 // Create a callable that invokes the EJB 30 Callable<String> callable = () -> { 31 // Create an InitialContext 32 Properties properties = new Properties(); 33 properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory"); 34 properties.put(Context.PROVIDER_URL, "remote+http://127.0.0.1:8080"); 35 InitialContext initialContext = new InitialContext(properties); 36 37 // Look up the EJB and invoke one of its methods 38 // Note that this code is the same as before 39 SampleService sampleService = (SampleService) initialContext.lookup( 40 "ejb:/EARProject-1.0-SNAPSHOT/EJBProject/SampleServiceBean!com.example.SampleService"); 41 String result = sampleService.sayHello("ejb"); 42 return result; 43 }; 44 45 // Use the authentication context to run the callable 46 mav.addObject("result", context.runCallable(callable)); 47 48 return mav; 49 } 50} 51

試したこと・調べたこと

  • teratailやGoogle等で検索した
  • ソースコードを自分なりに変更した
  • 知人に聞いた
  • その他
上記の詳細・結果

エラーを検索したところ、SASLの認証エラーで、WildFly側になんらかの認証設定をしないと接続できない様な気がするのですが、具体的な設定方法が分からず、困っています。

補足

特になし

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

katatema01

2025/04/10 04:04

https://github.com/wildfly/quickstart/tree/33.0.2.Final/ejb-multi-server 公式のquickstartとして、サンプルがあるのを発見。 WLS2上、手順通りに成功することが、確認できました。 ただ、マルチサーバではあるものの同一IPで動作しているので、これをdockerコンテナとローカルに分離して再現できるかを確認する必要がありそう。
katatema01

2025/04/10 23:30

docker上のapp-twoにローカルからquickuser2で、アクセス可能な事を確認。 自己解決に至りそう。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.30%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問