Author: richard.opalka(a)jboss.com
Date: 2008-05-26 04:36:05 -0400 (Mon, 26 May 2008)
New Revision: 7157
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/webserviceref/EJB3Client.java
Log:
[EJBTHREE-1378] AS trunk EJB3 implementation uses java:comp instead of java:comp.ejb3 now
Modified:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/webserviceref/EJB3Client.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/webserviceref/EJB3Client.java 2008-05-24
16:50:01 UTC (rev 7156)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/samples/webserviceref/EJB3Client.java 2008-05-26
08:36:05 UTC (rev 7157)
@@ -26,6 +26,7 @@
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceRef;
import javax.xml.ws.WebServiceRefs;
@@ -84,25 +85,48 @@
{
log.info("echo: " + inStr);
+ InitialContext initCtx = null;
+ String envRoot = "java:comp.ejb3";
+ try
+ {
+ initCtx = new InitialContext();
+ initCtx.lookup(envRoot + "/env/service1");
+ }
+ catch (NamingException ne)
+ {
+ if (initCtx == null)
+ throw new WebServiceException(ne);
+
+ // EJBTHREE-1378
+ envRoot = "java:comp";
+ try
+ {
+ initCtx.lookup(envRoot + "/env/service1");
+ }
+ catch (Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+
ArrayList<Endpoint> ports = new ArrayList<Endpoint>();
try
{
- InitialContext iniCtx = new InitialContext();
-
ports.add(((EndpointService)iniCtx.lookup("java:comp.ejb3/env/service1")).getEndpointPort());
-
ports.add(((EndpointService)iniCtx.lookup("java:comp.ejb3/env/service2")).getEndpointPort());
+ ports.add(((EndpointService)initCtx.lookup(envRoot +
"/env/service1")).getEndpointPort());
+ ports.add(((EndpointService)initCtx.lookup(envRoot +
"/env/service2")).getEndpointPort());
ports.add((Endpoint)service3.getPort(Endpoint.class));
-
ports.add(((EndpointService)iniCtx.lookup("java:comp.ejb3/env/EndpointService3")).getEndpointPort());
+ ports.add(((EndpointService)initCtx.lookup(envRoot +
"/env/EndpointService3")).getEndpointPort());
ports.add((Endpoint)service4.getPort(Endpoint.class));
- ports.add(((EndpointService)iniCtx.lookup("java:comp.ejb3/env/" +
getClass().getName() + "/service4")).getEndpointPort());
+ ports.add(((EndpointService)initCtx.lookup(envRoot + "/env/" +
getClass().getName() + "/service4")).getEndpointPort());
ports.add((Endpoint)service5.getPort(Endpoint.class));
-
ports.add(((EndpointService)iniCtx.lookup("java:comp.ejb3/env/EndpointService5")).getEndpointPort());
+ ports.add(((EndpointService)initCtx.lookup(envRoot +
"/env/EndpointService5")).getEndpointPort());
ports.add((Endpoint)service6.getPort(Endpoint.class));
- ports.add(((EndpointService)iniCtx.lookup("java:comp.ejb3/env/" +
getClass().getName() + "/service6")).getEndpointPort());
- ports.add((Endpoint)iniCtx.lookup("java:comp.ejb3/env/port1"));
+ ports.add(((EndpointService)initCtx.lookup(envRoot + "/env/" +
getClass().getName() + "/service6")).getEndpointPort());
+ ports.add((Endpoint)initCtx.lookup(envRoot + "/env/port1"));
ports.add(port2);
- ports.add((Endpoint)iniCtx.lookup("java:comp.ejb3/env/Port2"));
+ ports.add((Endpoint)initCtx.lookup(envRoot + "/env/Port2"));
ports.add(port3);
- ports.add((Endpoint)iniCtx.lookup("java:comp.ejb3/env/" +
getClass().getName() + "/port3"));
+ ports.add((Endpoint)initCtx.lookup(envRoot + "/env/" +
getClass().getName() + "/port3"));
}
catch (Exception ex)
{