実現したいこと
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側になんらかの認証設定をしないと接続できない様な気がするのですが、具体的な設定方法が分からず、困っています。
補足
特になし
あなたの回答
tips
プレビュー