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.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:jaxws="http://cxf.apache.org/jaxws";
    xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://cxf.apache.org/jaxws 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 <[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-**
>> 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
>
>

Reply via email to