Hi, I am using cxf-protobuf 0.3, CXF framework 2.3 and Protobuf-java 2.3 in my 
web application, which runs on Tomcat 7.

I create 2 services with these steps:

*1.*
        <bean class="com.package.ServicesFactoryBean"
                init-method="create" destroy-method="destroy">
                <property name="serviceName" value="ContextService" />
                <property name="protoPackage" value="ContextProtos" />
                <property name="production" value="true" />
        </bean>
        
        <bean class="com.package.ServicesFactoryBean"
                init-method="create" destroy-method="destroy">
                <property name="serviceName" value="JobService" />
                <property name="protoPackage" value="JobProtos" />
                <property name="production" value="true" />
        </bean>

2. Implementation of bean:

public class ServicesFactoryBean {

        ProtobufServerFactoryBean factoryBean = new ProtobufServerFactoryBean();
        String serviceName;
        String protoPackage;
        Server server;

        boolean production = true;

        @SuppressWarnings({ "rawtypes", "unchecked" })
        public Server create() throws InstantiationException, 
IllegalAccessException, ClassNotFoundException {
                if (getServiceName() == null)
                        throw new IllegalStateException("Service name not set in 
services.xml");

                String pkg;
                if (isProduction())
                        pkg = "com.package.core.srv.";
                else
                        pkg = "com.package.core.srv.stub.";
                Class srvBeanClass = Class.forName(pkg + getServiceName() + 
"Impl");
                Class msgBeanClass = Class.forName("com.package.proto." + 
getProtoPackage() + "$"
                                + getServiceName() + "Message");
                factoryBean.setAddress("http://
                                + 
ClanCoreProperties.getInstance().getProperty(ClanCoreProperties.CORE_JETTY_HOST_NAME) + 
":"
                                + 
ClanCoreProperties.getInstance().getProperty(ClanCoreProperties.CORE_JETTY_PORT) + 
"/"
                                + getServiceName());
                factoryBean.setServiceBean(srvBeanClass.newInstance());
                factoryBean.setMessageClass(msgBeanClass);

                server = factoryBean.create();
                return server;
        }

        public void destroy() {
                server.stop();
        }

        public String getServiceName() {
                return serviceName;
        }

        public void setServiceName(String serviceName) {
                this.serviceName = serviceName;
        }

        public boolean isProduction() {
                return production;
        }

        public void setProduction(boolean production) {
                this.production = production;
        }

        public String getProtoPackage() {
                return protoPackage;
        }

        public void setProtoPackage(String protoPackage) {
                this.protoPackage = protoPackage;
        }

}

When I undeploy application from Tomcat, I get warnings about unclosed threads.

1.12.2010 14:05:10 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/clan-cr-20101201] appears to have started a 
thread named [qtp12098501-23] but has failed to stop it. This is very likely to 
create a memory leak.
1.12.2010 14:05:10 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/clan-cr-20101201] appears to have started a 
thread named [qtp12098501-24] but has failed to stop it. This is very likely to 
create a memory leak.
1.12.2010 14:05:10 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/clan-cr-20101201] appears to have started a 
thread named [qtp12098501-25] but has failed to stop it. This is very likely to 
create a memory leak.
1.12.2010 14:05:10 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/clan-cr-20101201] appears to have started a 
thread named [qtp12098501-26] but has failed to stop it. This is very likely to 
create a memory leak.
1.12.2010 14:05:10 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/clan-cr-20101201] appears to have started a 
thread named [qtp12098501-27] but has failed to stop it. This is very likely to 
create a memory leak.
1.12.2010 14:05:10 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/clan-cr-20101201] appears to have started a 
thread named [qtp12098501-28] but has failed to stop it. This is very likely to 
create a memory leak.
1.12.2010 14:05:10 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/clan-cr-20101201] appears to have started a 
thread named [qtp12098501-29] but has failed to stop it. This is very likely to 
create a memory leak.

When I remove starting these services, there are any warnings. Could you help 
me to fix these problems? Thanks a lot.


Reply via email to