Christian, I constructed a similar service (with CXF 2.4.4) for a Tomcat 7 deployment - ran the profile software and .. only one instance - similarily with Glassfish 2.1. I guess this means that it may be an issue with Glassfish 3.1?
Marcus On Sun, Dec 11, 2011 at 1:28 AM, Christian Schneider < [email protected]> wrote: > That looks all very normal. Using this setup you should normally get only > one instance. > > Btw as your config does not seem to be special for glassfish you might try > to deploy your war to a simple tomcat and see how it reacts. > If you get only one instance on tomcat then your config should be all > right. > > Christian > > > Am 10.12.2011 13:03, schrieb Marcus Young: > >> Christian, >> >> I will try to recreate the issue in a new build environment - although I >> am >> also seeing the same issue with other test systems. The CXF segments of >> web.xml are: >> >> <servlet> >> <description>Apache CXF Endpoint</description> >> <display-name>cxf</display-**name> >> <servlet-name>cxf</servlet-**name> >> >> <servlet-class>org.apache.cxf.**transport.servlet.CXFServlet</** >> servlet-class> >> <load-on-startup>1</load-on-**startup> >> </servlet> >> <servlet-mapping> >> <servlet-name>cxf</servlet-**name> >> <url-pattern>/services/*</url-**pattern> >> </servlet-mapping> >> <session-config> >> <session-timeout>60</session-**timeout> >> </session-config> >> <context-param> >> <param-name>**contextConfigLocation</param-**name> >> <param-value>WEB-INF/beans.**xml</param-value> >> </context-param> >> <listener> >> >> <listener-class>org.**springframework.web.context.** >> ContextLoaderListener</**listener-class> >> </listener> >> >> On Sat, Dec 10, 2011 at 2:44 AM, Christian Schneider< >> [email protected]> wrote: >> >> Your code and config looks good to me. >>> Like Dan explained it looks like glassfish might be doing something >>> strange here. >>> >>> Can you perhaps create a complete project of your service? Perhaps the >>> problem is outside the spring config and >>> your service. >>> >>> One important question is how do you start the spring context? That is >>> probably in your web.xml. >>> >>> Christian >>> >>> Am 09.12.2011 13:39, schrieb Marcus Young: >>> >>> Hi Christian, >>>> >>>> I have included the code segments below. The commented out section was >>>> the >>>> original functionality that I removed in order to just focus on the >>>> service >>>> implementation itself. I have since created another simple service that >>>> returns a String - with the same result. Each time the service is >>>> invoked >>>> a new service implementation object is created on the heap. >>>> >>>> >>>> @WebService(name = "HL7Service", targetNamespace = " >>>> http://ws.foo.bar.com/") >>>> public interface HL7Service { >>>> @WebMethod(operationName = "submit", action = "urn:Submit") >>>> public void submit(@WebParam(name = "msg") String msg); >>>> } >>>> >>>> >>>> @WebService(targetNamespace = "http://ws.foo.bar.com/", >>>> endpointInterface = "com.bar.foo.ws.HL7Service", portName = >>>> "HL7ServiceImplPort", serviceName = "HL7ServiceImplService") >>>> public class HL7ServiceImpl implements HL7Service { >>>> public void submit (String msg) { >>>> >>>> // if (msg == null) >>>> // return ("NAK"); >>>> // else >>>> // EventQueue.getInstance().****submit(msg); >>>> >>>> // >>>> // return "ACK"; >>>> >>>> if (msg != null) { // temp >>>> // DO nothing >>>> } >>>> } >>>> } >>>> >>>> >>>> <?xml version="1.0" encoding="UTF-8"?> >>>> <beans >>>> xmlns="http://www.**springfram**ework.org/schema/**beans<http://springframework.org/schema/**beans> >>>> <http:**//www.springframework.org/**schema/beans<http://www.springframework.org/schema/beans> >>>> > >>>> " >>>> >>>> xmlns:xsi="http://www.w3.org/****2001/XMLSchema-instance<http://www.w3.org/**2001/XMLSchema-instance> >>>> <http:**//www.w3.org/2001/XMLSchema-**instance<http://www.w3.org/2001/XMLSchema-instance> >>>> > >>>> " >>>> xmlns:jaxws="http://cxf.**apac**he.org/jaxws <http://apache.org/jaxws>< >>>> http://cxf.**apache.org/jaxws <http://cxf.apache.org/jaxws>>" >>>> xsi:schemaLocation="http://**w**ww.springframework.org/**** >>>> schema/beans <http://www.springframework.org/**schema/beans>< >>>> http://www.**springframework.org/schema/**beans<http://www.springframework.org/schema/beans> >>>> > >>>> http://www.springframework.****org/schema/beans/spring-beans-** >>>> **2.5.xsd<http://www.**springframework.org/schema/** >>>> beans/spring-beans-2.5.xsd<http://www.springframework.org/schema/beans/spring-beans-2.5.xsd> >>>> > >>>> http://cxf.apache.org/jaxws >>>> http://cxf.apache.org/schemas/****jaxws.xsd<http://cxf.apache.org/schemas/**jaxws.xsd> >>>> <http://cxf.apache.**org/schemas/jaxws.xsd<http://cxf.apache.org/schemas/jaxws.xsd> >>>> > >>>> "> >>>> <import resource="classpath:META-INF/****cxf/cxf.xml" /> >>>> <import resource="classpath:META-INF/****cxf/cxf-servlet.xml" /> >>>> <jaxws:endpoint id="hl7service" >>>> implementor="com.bar.foo.ws.****HL7ServiceImpl" >>>> address="/hl7service"> >>>> <jaxws:features> >>>> <bean class="org.apache.cxf.feature.****LoggingFeature" /> >>>> >>>> </jaxws:features> >>>> </jaxws:endpoint> >>>> </beans> >>>> >>>> >>>> >>>> Marcus >>>> >>>> On Fri, Dec 9, 2011 at 7:53 PM, Christian Schneider<chris@die-schneider. >>>> *** >>>> *net<[email protected]> >>>> >>>> wrote: >>>>> Hi Marcus, >>>>> >>>>> it would help a lot if you could post your config/code so we see what >>>>> you >>>>> did. >>>>> You should really only instantiate the service once. >>>>> >>>>> Christian >>>>> >>>>> Am 09.12.2011 09:10, schrieb Marcus Young: >>>>> >>>>> I am sure that this has a very simple explanation, however I am still >>>>> very >>>>> >>>>> much in the learning phase with CXF. >>>>>> >>>>>> I have built a simple web service using the tooling in Eclipse >>>>>> (Dynamic >>>>>> web >>>>>> project / Glassfish 3 / CXF 2.4). The service receives a String and >>>>>> writes >>>>>> it to a database. I have noticed that after running for some time the >>>>>> application runs out of heap space. Using a profiling tool I found >>>>>> that >>>>>> for each invocation of the service an implementation object was >>>>>> created >>>>>> on >>>>>> the heap. These remained until the JVM ran out of heap space. From a >>>>>> posting on Stack Overflow ( >>>>>> http://stackoverflow.com/******questions/8427329/possible-**<http://stackoverflow.com/****questions/8427329/possible-**> >>>>>> <**http://stackoverflow.com/****questions/8427329/possible-**<http://stackoverflow.com/**questions/8427329/possible-**> >>>>>> > >>>>>> memory-leak-cxf-2-4-2-******glassfish-3<http://** >>>>>> stackoverflow.com/questions/****8427329/possible-memory-leak-****<http://stackoverflow.com/questions/**8427329/possible-memory-leak-**> >>>>>> cxf-2-4-2-glassfish-3<http://**stackoverflow.com/questions/** >>>>>> 8427329/possible-memory-leak-**cxf-2-4-2-glassfish-3<http://stackoverflow.com/questions/8427329/possible-memory-leak-cxf-2-4-2-glassfish-3> >>>>>> > >>>>>> >>>>>> ) >>>>>> it was suggested that a service implementation should essentially be a >>>>>> Singleton and only one instance should ever be created which is >>>>>> clearly >>>>>> not >>>>>> the case in my situation. I have started to think that it may have >>>>>> something to do with the way I have configured CXF although I have not >>>>>> been >>>>>> able to find any information that relates to the issue that I >>>>>> am experiencing. >>>>>> >>>>>> There is obviously a hole in my understanding or the code that I have >>>>>> written - any advice or guidance would be very much appreciated. >>>>>> >>>>>> Marcus >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>> Christian Schneider >>>>> http://www.liquid-reality.de >>>>> >>>>> Open Source Architect >>>>> Talend Application Integration Division http://www.talend.com >>>>> >>>>> >>>>> >>>>> -- >>> >>> Christian Schneider >>> http://www.liquid-reality.de >>> >>> Open Source Architect >>> Talend Application Integration Division http://www.talend.com >>> >>> >>> > > -- > > Christian Schneider > http://www.liquid-reality.de > > Open Source Architect > Talend Application Integration Division http://www.talend.com > >
