[ 
https://issues.apache.org/jira/browse/TOMEE-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13502801#comment-13502801
 ] 

John D. Ament commented on TOMEE-599:
-------------------------------------

I was pointed to section 4.4.2.2 (EJB 3.1) which specifies multiple client 
views.

4.4.2.2 Session bean exposing multiple client views
package com.acme;
@Singleton(name=”Shared”)
@LocalBean
@Remote(com.acme.SharedRemote.class)
public class SharedBean { ... }
If SharedBean is packaged in shared.jar without a deployment descriptor and 
deployed as a
stand-alone module, the resulting global JNDI name entries are :
java:global/shared/Shared!com.acme.SharedBean
java:global/shared/Shared!com.acme.SharedRemote
java:app/shared/Shared!com.acme.SharedBean
java:app/shared/Shared!com.acme.SharedRemote
java:module/Shared!com.acme.SharedBean
java:module/Shared!com.acme.SharedRemote

                
> TomEE exposing Remote JNDI names not per 
> -----------------------------------------
>
>                 Key: TOMEE-599
>                 URL: https://issues.apache.org/jira/browse/TOMEE-599
>             Project: TomEE
>          Issue Type: Bug
>          Components: Compliance Checks
>    Affects Versions: 1.5.0
>            Reporter: John D. Ament
>
> Section 4.4.2.2 of the EJB 3.1 spec states that the following JNDI locations 
> should be populated for "other client views," which includes remote.  TomEE 
> is instead exposing it as BeanName + Remote.
> This was shown with the following test material
> @Remote
> public interface RemoteDatabaseIntegrator {
>       public void runQuery(String query) throws SQLException;
> }
> @Remote(RemoteDatabaseIntegrator.class)
> @Stateless(name="RemoteDatabaseIntegrator")
> public class RemoteDatabaseIntegratorImpl implements RemoteDatabaseIntegrator 
> {
>       @Resource(name="jdbc/AppDS")
>       private DataSource ds;
>       private Connection conn;
>       @PostConstruct
>       public void init() throws SQLException {
>               this.conn = ds.getConnection();
>       }
>       @PreDestroy
>       public void cleanup() throws SQLException {
>               this.conn.close();
>       }
>       public void runQuery(String query) throws SQLException {
>               this.conn.createStatement().execute(query);
>       }
> }
> @RunWith(Arquillian.class)
> @RunAsClient
> public class RemoteDatabaseIntegratorTest {
>       @Deployment(testable=false)
>       public static JavaArchive createTestArchive() {
>               return ShrinkWrap.create(JavaArchive.class,"test.jar")
>                               
> .addClasses(RemoteDatabaseIntegrator.class,RemoteDatabaseIntegratorImpl.class);
>       }
>       
>       @ArquillianResource
>       private URL deploymentURL;
>       
>       private static final String JNDI_LOC = "RemoteDatabaseIntegratorRemote";
>       
>       @Test
>       public void testDbServiceInjectionFailure() throws Exception{
>               Properties p = new Properties();
>               p.put("java.naming.factory.initial", 
> "org.apache.openejb.client.RemoteInitialContextFactory");
>               String providerUrl = 
> String.format("http://%s:%s/tomee/ejb",deploymentURL.getHost(),deploymentURL.getPort());
>               p.put("java.naming.provider.url", providerUrl);
>               Context context = new InitialContext(p);
>               RemoteDatabaseIntegrator dbIntegrator = 
> (RemoteDatabaseIntegrator)context.lookup(JNDI_LOC);
>               dbIntegrator.runQuery("select 1");
>       }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to