On Sep 16, 2012, at 8:16 AM, Alex The Rocker wrote:

> Hello,
> 
> Can the webapps/tomee directory be deleted for deploying a web app to
> production TomEE/TomEE+ server and exposed to Internet?
> Indeed, when delivering our app with Tomcat, we delete all default web apps
> as part of a list of Tomcat hardening task list.
> 
> Is there any TomEE/TomE++ vital content in webapps/tomee directory ?

The only loss of functionality would be the ability to remotely execute EJBs 
over HTTP.  However this can easily be added to a different webapp like so:

    <servlet>
      <servlet-name>ServerServlet</servlet-name>
      
<servlet-class>org.apache.openejb.server.httpd.ServerServlet</servlet-class>
    </servlet>
  
    <servlet-mapping>
      <servlet-name>ServerServlet</servlet-name>
      <url-pattern>/myejbs/*</url-pattern>
    </servlet-mapping>

  
Then you can create an `InitialContext` that points to that webapp like so:

    Properties p = new Properties();
    p.put("java.naming.factory.initial", 
"org.apache.openejb.client.RemoteInitialContextFactory");
    p.put("java.naming.provider.url", "http://127.0.0.1:8080/mywebapp/myejbs";);
    // user and pass optional
    p.put("java.naming.security.principal", "myuser");
    p.put("java.naming.security.credentials", "mypass");
    
    InitialContext ctx = new InitialContext(p);
    
    MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");


-David


Reply via email to