[jboss-jira] [JBoss JIRA] (WFLY-13600) EJB client over HTTP Fail on Java SE

Gergely Molnár (Jira) issues at jboss.org
Thu Jun 18 11:13:53 EDT 2020


Gergely Molnár created WFLY-13600:
-------------------------------------

             Summary: EJB client over HTTP Fail on Java SE
                 Key: WFLY-13600
                 URL: https://issues.redhat.com/browse/WFLY-13600
             Project: WildFly
          Issue Type: Bug
          Components: Application Client
    Affects Versions: 20.0.0.Final
            Reporter: Gergely Molnár
            Assignee: Brian Stansberry


Java SE code:
{code:java}
public class Application {
 private static final String REMOTE_CALC = "ejb:/remote-ejb/RemoteCalc!" + RemoteCalc.class.getName();

/**
 * Lookup remote \{@link RemoteCalc}.
 * 
 * @return a \{@link RemoteCalc} object
 * @throws NamingException Something is wrong
 */
 public static RemoteCalc getRemoteCalc() throws NamingException {
 Hashtable<String, Object> jndiProps = new Hashtable<>();
 jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
 // remote+http connection (work fine)
 //jndiProps.put(Context.PROVIDER_URL, "remote+http://127.0.0.1:8080/remote-ejb");
 // http connection (fail)
 jndiProps.put(Context.PROVIDER_URL, "http://127.0.0.1:8080/wildfly-services");
 Context context = new InitialContext(jndiProps);

return (RemoteCalc) context.lookup(REMOTE_CALC);
 }

/**
 * Call to run (main).
 * 
 * @param args parameters (not used)
 * @throws NamingException Something is wrong
 */
 public static void main(String[] args) throws NamingException {
 
 RemoteCalc remoteCalc = getRemoteCalc();
 System.out.println("Remote calc 95 + 76: " + remoteCalc.add(95, 76));
 }
}
{code}

Exception:
Exception in thread "main" javax.naming.InvalidNameException: WFNAM00007: Invalid URL scheme name "http"
 at org.wildfly.naming.client.WildFlyRootContext.getProviderContext(WildFlyRootContext.java:808)
 at org.wildfly.naming.client.WildFlyRootContext.lookup(WildFlyRootContext.java:140)
 at javax.naming.InitialContext.lookup(Unknown Source)
 at com.bosch.emea.bpart.remoteejbclient.Application.getRemoteCalc(Application.java:34)
 at com.bosch.emea.bpart.remoteejbclient.Application.main(Application.java:47)

Lib:
{code:java}
@Remote
public interface RemoteCalc {
 /**
 * Add two integer.
 * 
 * @param a an integer
 * @param b an integer
 * @return a + b
 */
 public int add(int a, int b);
 
}
{code}

Config:

{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <authentication-client xmlns="urn:elytron:1.0">
 <authentication-rules>
 <rule use-configuration="default" />
 </authentication-rules>
 <authentication-configurations>
 <configuration name="default">
 <sasl-mechanism-selector selector="#ALL" />
 <set-mechanism-properties>
 <property key="wildfly.sasl.local-user.quiet-auth" value="true" />
 </set-mechanism-properties>
 <providers>
 <use-service-loader/>
 </providers>
 </configuration>
 </authentication-configurations>
 </authentication-client>
</configuration>
{code}

Maven dependency:

{code:xml}
<dependency>
 <groupId>org.wildfly</groupId>
 <artifactId>wildfly-ejb-client-bom</artifactId>
 <version>18.0.1.Final</version>
 <type>pom</type>
</dependency>
{code}

 



--
This message was sent by Atlassian Jira
(v7.13.8#713008)



More information about the jboss-jira mailing list