You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2012/01/04 11:38:40 UTC

svn commit: r1227107 - in /openejb/trunk/openejb: arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/ arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/ arquillian-t...

Author: rmannibucau
Date: Wed Jan  4 10:38:39 2012
New Revision: 1227107

URL: http://svn.apache.org/viewvc?rev=1227107&view=rev
Log:
adding a jaxws arquillian test with tomee embedded. fixing the way webservices are deployed in tomee (some path correction). Allowing to choose the subcontext through a system property. Removing the old way to deploy webservice in tomee if a flag is not set. Adding the ability to set system proeprties in arquillian tomee embedded in arquillian.xml

Added:
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello2.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS2.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/JAXWSTest.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/log4j.xml
Modified:
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/pom.xml
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/arquillian.xml
    openejb/trunk/openejb/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java
    openejb/trunk/openejb/tomee/tomee-webservices/pom.xml
    openejb/trunk/openejb/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java?rev=1227107&r1=1227106&r2=1227107&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java (original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEConfiguration.java Wed Jan  4 10:38:39 2012
@@ -20,6 +20,12 @@ package org.apache.openejb.arquillian.co
 import org.jboss.arquillian.container.spi.ConfigurationException;
 import org.jboss.arquillian.container.spi.client.container.ContainerConfiguration;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Properties;
+
 public class TomEEConfiguration implements ContainerConfiguration {
 
     private int httpPort = 8080;
@@ -28,6 +34,11 @@ public class TomEEConfiguration implemen
     private boolean plusContainer = true;
     private String tomcatVersion = null;
     private String openejbVersion = "1.0.0-beta-1";
+    private String systemProperties = "openejb.log.factory = org.apache.openejb.util.Log4jLogStreamFactory\n" +
+            "openejb.logger.external = true\n" +
+            "log4j.rootLogger = info, stdout\n" +
+            "log4j.appender.stdout = org.apache.log4j.ConsoleAppender\n" +
+            "log4j.appender.stdout.layout = org.apache.log4j.SimpleLayout";
 
     public int getHttpPort() {
         return httpPort;
@@ -77,6 +88,30 @@ public class TomEEConfiguration implemen
 		this.openejbVersion = openejbVersion;
 	}
 
-	public void validate() throws ConfigurationException {
+    public String getSystemProperties() {
+        return systemProperties;
+    }
+
+    public void setSystemProperties(String systemProperties) {
+        this.systemProperties = systemProperties;
+    }
+
+    public Properties systemProperties() {
+        final Properties p = new Properties();
+        final Reader reader = new StringReader(systemProperties);
+        try {
+            p.load(new InputStream() {
+                @Override
+                public int read() throws IOException {
+                    return reader.read();
+                }
+            });
+        } catch (IOException e) {
+            throw new RuntimeException("can't read " + systemProperties);
+        }
+        return p;
+    }
+
+    public void validate() throws ConfigurationException {
     }
 }

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java?rev=1227107&r1=1227106&r2=1227107&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java (original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java Wed Jan  4 10:38:39 2012
@@ -40,6 +40,7 @@ import javax.enterprise.inject.spi.BeanM
 import javax.naming.Context;
 import java.io.File;
 import java.util.Map;
+import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
 
 public class EmbeddedTomEEContainer extends TomEEContainer {
@@ -53,18 +54,17 @@ public class EmbeddedTomEEContainer exte
     private static final Map<Archive<?>, File> ARCHIVES = new ConcurrentHashMap<Archive<?>, File>();
 
     private Container container;
-
-    public EmbeddedTomEEContainer() {
-        container = new Container();
-    }
+    private Properties savedProperties;
 
     public Class<TomEEConfiguration> getConfigurationClass() {
         return TomEEConfiguration.class;
     }
 
     public void setup(TomEEConfiguration configuration) {
-        container.setup(convertConfiguration(configuration));
         this.configuration = configuration;
+        setSystemProperties();
+        container = new Container();
+        container.setup(convertConfiguration(configuration));
     }
 
     /*
@@ -99,12 +99,37 @@ public class EmbeddedTomEEContainer exte
         }
     }
 
+    private void setSystemProperties() {
+        savedProperties = new Properties();
+        final Properties props = System.getProperties();
+        for (Map.Entry<Object, Object> entry : configuration.systemProperties().entrySet()) {
+            final String key = (String) entry.getKey();
+            if (props.contains(key)) {
+                savedProperties.put(key, System.getProperty(key));
+            }
+            props.setProperty(key, (String) entry.getValue());
+        }
+    }
+
+    private void clearSystemProperties() {
+        final Properties props = System.getProperties();
+        for (Map.Entry<Object, Object> entry : configuration.systemProperties().entrySet()) {
+            final String key = (String) entry.getKey();
+            if (savedProperties.contains(key)) {
+                System.setProperty(key, savedProperties.getProperty(key));
+            } else {
+                props.remove(key);
+            }
+        }
+    }
+
     public void stop() throws LifecycleException {
         try {
             container.stop();
         } catch (Exception e) {
             throw new LifecycleException("Unable to stop server", e);
         }
+        clearSystemProperties();
     }
 
     public ProtocolDescription getDefaultProtocol() {

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/pom.xml?rev=1227107&r1=1227106&r2=1227107&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/pom.xml (original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/pom.xml Wed Jan  4 10:38:39 2012
@@ -17,7 +17,6 @@
     <groupId>org.apache.openejb</groupId>
     <version>1.0-SNAPSHOT</version>
   </parent>
-  <groupId>org.apache.openejb</groupId>
   <artifactId>arquillian-tomee-tests</artifactId>
   <version>1.0-SNAPSHOT</version>
   <packaging>jar</packaging>
@@ -28,8 +27,7 @@
     <dependency>
       <groupId>org.apache.openejb</groupId>
       <artifactId>javaee-api</artifactId>
-      <version>6.0-1</version>
-      <type>jar</type>
+      <version>${javaee-api.version}</version>
     </dependency>
 
     <dependency>
@@ -60,6 +58,17 @@
       <type>jar</type>
       <scope>compile</scope>
     </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>tomee-webservices</artifactId>
+      <version>${version.openejb}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+    </dependency>
   </dependencies>
 
   <build>

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello.java?rev=1227107&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello.java (added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello.java Wed Jan  4 10:38:39 2012
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.openejb.arquillian.tests.jaxws;
+
+import javax.jws.WebService;
+
+@WebService(portName = "HelloWSPort")
+public interface Hello {
+    String hi(String name);
+}

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello2.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello2.java?rev=1227107&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello2.java (added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/Hello2.java Wed Jan  4 10:38:39 2012
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.openejb.arquillian.tests.jaxws;
+
+import javax.jws.WebService;
+
+// a copy to be sure we can deploy 2 WS (was a bug in the beta-1 because of a hardcoded name)
+@WebService(portName = "Hello2WSPort")
+public interface Hello2 {
+    String hi(String name);
+}

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS.java?rev=1227107&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS.java (added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS.java Wed Jan  4 10:38:39 2012
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.openejb.arquillian.tests.jaxws;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
+import javax.jws.WebService;
+
+@WebService
+@Singleton
+@Lock(LockType.READ)
+public class HelloWS implements Hello {
+    @Override
+    public String hi(String name) {
+        return "hi " + name + "!";
+    }
+}

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS2.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS2.java?rev=1227107&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS2.java (added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/HelloWS2.java Wed Jan  4 10:38:39 2012
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.openejb.arquillian.tests.jaxws;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
+import javax.jws.WebService;
+
+@WebService
+@Singleton
+@Lock(LockType.READ)
+public class HelloWS2 implements Hello2 {
+    @Override
+    public String hi(String name) {
+        return "hi " + name + "!";
+    }
+}

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/JAXWSTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/JAXWSTest.java?rev=1227107&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/JAXWSTest.java (added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/JAXWSTest.java Wed Jan  4 10:38:39 2012
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.openejb.arquillian.tests.jaxws;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(Arquillian.class)
+public class JAXWSTest {
+    @Deployment(testable = false)
+    public static WebArchive createDeployment() {
+        return ShrinkWrap.create(WebArchive.class, "jaxws-test.war")
+                .addClass(Hello.class).addClass(HelloWS.class)
+                .addClass(Hello2.class).addClass(HelloWS2.class) // just to check conflict names in WS deployement (old bug)
+                .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class)
+                        .version("3.0").exportAsString()))
+                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("ejb-jar.xml"));
+    }
+
+    @Test
+    public void invoke() throws Exception {
+        final Service service = Service.create(new URL("http://localhost:" + System.getProperty("tomee.http.port", "11080") + "/jaxws-test/webservices/HelloWS?wsdl"), new QName("http://jaxws.tests.arquillian.openejb.apache.org/", "HelloWSService"));
+        final Hello hello = service.getPort(Hello.class);
+        assertEquals("hi foo!", hello.hi("foo"));
+    }
+}

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/arquillian.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/arquillian.xml?rev=1227107&r1=1227106&r2=1227107&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/arquillian.xml (original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/arquillian.xml Wed Jan  4 10:38:39 2012
@@ -27,6 +27,13 @@
                <property name="stopPort">11005</property>
                <property name="tomcatVersion"></property>
                <property name="openejbVersion">1.0.0-beta-2-SNAPSHOT</property>
+               <property name="systemProperties">
+                 openejb.log.factory = org.apache.openejb.util.Log4jLogStreamFactory
+                 openejb.logger.external = true
+                 log4j.rootLogger = info, stdout
+                 log4j.appender.stdout = org.apache.log4j.ConsoleAppender
+                 log4j.appender.stdout.layout = org.apache.log4j.SimpleLayout
+               </property>
            </configuration>
        </container>
 </arquillian>
\ No newline at end of file

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/log4j.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/log4j.xml?rev=1227107&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/log4j.xml (added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-tests/src/test/resources/log4j.xml Wed Jan  4 10:38:39 2012
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+  <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out"/>
+    <layout class="org.apache.log4j.SimpleLayout"/>
+  </appender>
+  <root>
+    <priority value="info"/>
+    <appender-ref ref="stdout"/>
+  </root>
+</log4j:configuration>

Modified: openejb/trunk/openejb/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java?rev=1227107&r1=1227106&r2=1227107&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java (original)
+++ openejb/trunk/openejb/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java Wed Jan  4 10:38:39 2012
@@ -265,7 +265,7 @@ public abstract class WsService implemen
 
                                 List<String> addresses = wsRegistry.addWsContainer(webContextByEjb.get(bean.ejbClass), location, container, virtualHost, realm, transport, auth, classLoader);
 
-                                // one of the registered addresses to be the cannonical address
+                                // one of the registered addresses to be the canonical address
                                 String address = HttpUtil.selectSingleAddress(addresses);
 
                                 if (address != null) {

Modified: openejb/trunk/openejb/tomee/tomee-webservices/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webservices/pom.xml?rev=1227107&r1=1227106&r2=1227107&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webservices/pom.xml (original)
+++ openejb/trunk/openejb/tomee/tomee-webservices/pom.xml Wed Jan  4 10:38:39 2012
@@ -66,6 +66,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-cxf</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
       <artifactId>tomee-common</artifactId>
       <version>${project.version}</version>
     </dependency>

Modified: openejb/trunk/openejb/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java?rev=1227107&r1=1227106&r2=1227107&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java (original)
+++ openejb/trunk/openejb/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java Wed Jan  4 10:38:39 2012
@@ -54,6 +54,9 @@ import static org.apache.tomee.catalina.
 import static org.apache.tomee.catalina.TomcatWebAppBuilder.IGNORE_CONTEXT;
 
 public class TomcatWsRegistry implements WsRegistry {
+    private static final String WEBSERVICE_SUB_CONTEXT = System.getProperty("tomee.jaxws.subcontext", "/webservices");
+    private static final boolean WEBSERVICE_OLDCONTEXT_ACTIVE = Boolean.getBoolean("tomee.jaxws.oldsubcontext");
+
     private final Map<String, Context> webserviceContexts = new TreeMap<String, Context>();
     private Engine engine;
     private List<Connector> connectors;
@@ -152,18 +155,20 @@ public class TomcatWsRegistry implements
 
         // build contexts
         // - old way (/*)
-        Context context = createNewContext(path, classLoader, authMethod, transportGuarantee, realmName);
-        host.addChild(context);
-        addServlet(host, context, "/*", httpListener, path, addresses);
+        if (WEBSERVICE_OLDCONTEXT_ACTIVE) {
+            Context context = createNewContext(path, classLoader, authMethod, transportGuarantee, realmName);
+            host.addChild(context);
+            addServlet(host, context, "/*", httpListener, path, addresses);
+        }
 
-        // - new way (/<webappcontext>/webservices/*) if webcontext is specified
+        // - new way (/<webappcontext>/webservices/<name>) if webcontext is specified
         if (webContext != null) {
             String root = webContext;
             if (!root.startsWith("/")) {
                 root = '/' + root;
             }
             Context webAppContext = (Context) host.findChild(root);
-            addServlet(host, webAppContext, "/webservices" + path +  "*", httpListener, path, addresses);
+            addServlet(host, webAppContext, WEBSERVICE_SUB_CONTEXT + path, httpListener, path, addresses);
         }
         return addresses;
     }
@@ -252,7 +257,6 @@ public class TomcatWsRegistry implements
 
         // add servlet to context
         context.addChild(wrapper);
-        wrapper.addMapping(mapping);
         context.addServletMapping(mapping, wrapper.getName());
 
         String webServicecontainerID = wrapper.getName() + WsServlet.WEBSERVICE_CONTAINER + httpListener.hashCode();
@@ -265,8 +269,22 @@ public class TomcatWsRegistry implements
 
         // register wsdl locations for service-ref resolution
         for (Connector connector : connectors) {
+            final StringBuilder fullContextpath;
+            if (!WEBSERVICE_OLDCONTEXT_ACTIVE) {
+                String contextPath = context.getName();
+                if (contextPath != null && !contextPath.startsWith("/")) {
+                    contextPath = "/" + contextPath;
+                } else if (contextPath == null) {
+                    contextPath = "/";
+                }
+                fullContextpath = new StringBuilder(contextPath)
+                        .append(WEBSERVICE_SUB_CONTEXT).append(path);
+            } else {
+                fullContextpath = new StringBuilder(path);
+            }
+
             try {
-                URI address = new URI(connector.getScheme(), null, host.getName(), connector.getPort(), path, null, null);
+                URI address = new URI(connector.getScheme(), null, host.getName(), connector.getPort(), fullContextpath.toString(), null, null);
                 addresses.add(address.toString());
             } catch (URISyntaxException ignored) {
                 // no-op
@@ -285,14 +303,16 @@ public class TomcatWsRegistry implements
         }
 
         Context context = webserviceContexts.remove(path);
-        try {
-            context.stop();
-            context.destroy();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-        Host host = (Host) context.getParent();
-        host.removeChild(context);
+        if (WEBSERVICE_OLDCONTEXT_ACTIVE) {
+            try {
+                context.destroy();
+                context.stop();
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            Host host = (Host) context.getParent();
+            host.removeChild(context);
+        } // else let tomcat manages its context
     }
 
     private void setWsContainer(Context context, Wrapper wrapper, HttpListener wsContainer) {