Results 1 to 8 of 8

Thread: My destination beans are getting destroyed after start up

Hybrid View

  1. #1
    Join Date
    Dec 2009
    Posts
    4

    Default My destination beans are getting destroyed after start up

    Hi,

    I made a spring, flex, spring security project based on the testdrive examples.

    spring 2.5.6, spring-security-core-tiger 2.0.4, spring-flex 1.0.1.RELEASE.

    On my mac, deploying the war in tomcat, works perfectly.
    I can log in, log out, persist some orders,...

    But it on windows, my destinations beans are destroyed just after creation. The war is still deployed. I can still access the swf, but as my channels are closed. I can't do anything.

    Please help me, I'm losing to much time with this and I really don't know where to look.

    Code:
    17:46:19,985 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Thread-1 - Finished creating instance of bean 'org.springframework.web.servlet.view.InternalResourceViewResolver'
    17:46:19,985 DEBUG org.springframework.web.servlet.DispatcherServlet Thread-1 - No ViewResolvers found in servlet 'Spring Dispatcher Servlet': using default
    17:46:19,985 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Thread-1 - Returning cached instance of singleton bean '_filterChainProxy'
    17:46:19,985 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Thread-1 - Returning cached instance of singleton bean '_requestContextFilter'
    17:46:19,985 DEBUG org.springframework.web.servlet.DispatcherServlet Thread-1 - Published WebApplicationContext of servlet 'Spring Dispatcher Servlet' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.Spring Dispatcher Servlet]
    17:46:19,985 INFO org.springframework.web.servlet.DispatcherServlet Thread-1 - FrameworkServlet 'Spring Dispatcher Servlet': initialization completed in 4112 ms
    17:46:19,985 DEBUG org.springframework.web.servlet.DispatcherServlet Thread-1 - Servlet 'Spring Dispatcher Servlet' configured successfully
    17:46:20,140 INFO org.springframework.web.context.support.XmlWebApplicationContext Thread-1 - c@120bf2c: display name [WebApplicationContext for namespace 'Spring Dispatcher Servlet-servlet']; startup date [Sun Dec 06 17:46:10 CET 2009]; root of context hierarchy
    17:46:20,141 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory Thread-1 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@189c036: defining beans [org.springframework.aop.config.internalAutoProxyCreator,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,securityHelper,service,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0,transactionManager,sessionFactory,_authenticationManager,_filterChainProxy,_httpSessionContextIntegrationFilter,_filterChainProxyPostProcessor,_filterChainList,_securityContextHolderAwareRequestFilter,_accessManager,_portMapper,_exceptionTranslationFilter,_filterSecurityInterceptor,_sessionFixationProtectionFilter,_entryPointInjectionBeanPostProcessor,_userServiceInjectionPostProcessor,preAuthenticatedEntryPoint,org.springframework.security.providers.dao.DaoAuthenticationProvider#0,_userDetailsService,org.springframework.security.config.AuthenticationProviderBeanDefinitionParser$AuthenticationProviderCacheResolver#0,allExceptionTranslator,_messageBrokerHandlerAdapter,_messageBrokerDefaultHandlerMapping,_jsonConfigMapEditorConfigurer,_messageBrokerMessagingProcessor,_flexRemotingAnnotationPostProcessor,_messageBrokerRemotingProcessor,org.springframework.flex.core.ExceptionTranslationAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#0,org.springframework.flex.core.MessageInterceptionAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#1,_sessionFixationProtectionConfigurer,_messageBrokerLoginCommand,org.springframework.flex.security.EndpointDefinitionSource#0,org.springframework.flex.security.EndpointInterceptor#0,_messageBrokerEndpointProcessor,_messageBroker,org.springframework.flex.remoting.RemotingDestinationExporter#0,org.springframework.flex.remoting.RemotingDestinationExporter#1]; root of factory hierarchy
    17:46:20,158 DEBUG org.springframework.beans.factory.support.DisposableBeanAdapter Thread-1 - Invoking destroy() on bean with name 'org.springframework.flex.remoting.RemotingDestinationExporter#1'
    17:46:20,158 INFO org.springframework.flex.remoting.RemotingDestinationExporter Thread-1 - Removing remoting destination 'service'
    17:46:20,158 DEBUG org.springframework.beans.factory.support.DisposableBeanAdapter Thread-1 - Invoking destroy() on bean with name 'org.springframework.flex.remoting.RemotingDestinationExporter#0'
    17:46:20,158 INFO org.springframework.flex.remoting.RemotingDestinationExporter Thread-1 - Removing remoting destination 'securityHelper'
    17:46:20,158 DEBUG org.springframework.beans.factory.support.DisposableBeanAdapter Thread-1 - Invoking destroy() on bean with name '_messageBroker'
    17:46:20,169 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Thread-1 - Retrieved dependent beans for bean '(inner bean)': [_accessManager]
    17:46:20,169 DEBUG org.springframework.beans.factory.support.DisposableBeanAdapter Thread-1 - Invoking destroy() on bean with name 'sessionFactory'
    17:46:20,169 INFO org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean Thread-1 - Closing Hibernate SessionFactory
    17:46:20,169 INFO org.hibernate.impl.SessionFactoryImpl Thread-1 - closing
    17:46:20,169 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Thread-1 - Retrieved dependent beans for bean 'org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy#1a85d38': [sessionFactory]
    17:46:20,169 DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory Thread-1 - Retrieved dependent beans for bean 'org.apache.commons.dbcp.BasicDataSource#173ec72': [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy#1a85d38]

  2. #2

    Default

    Can you post you web.xml, flex-servlet.xml and any thing else they are touching?

    Joshua

  3. #3
    Join Date
    Dec 2009
    Posts
    4

    Default

    Of course I can. I hope you can help me out

    web.xml

    Code:
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    		 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    		 version="2.4">
    
    	<display-name>Service</display-name>
    
       <context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/*-conf.xml
    		</param-value>
    	</context-param>
    
    	<filter>
    		 <filter-name>springSecurityFilterChain</filter-name>
    		 <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    	 </filter>
    
    	 <filter-mapping>
    	   <filter-name>springSecurityFilterChain</filter-name>
    	   <url-pattern>/*</url-pattern>
    	 </filter-mapping>
    
    	 <listener>
    		 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	 </listener>
    
    	 <listener>
    		 <listener-class>flex.messaging.HttpFlexSession</listener-class>
    	 </listener>
    
    	<servlet>
    		<servlet-name>flex</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>flex</servlet-name>
    		<url-pattern>/messagebroker/*</url-pattern>
    	</servlet-mapping>
    
    	<welcome-file-list>
    		<welcome-file>index.html</welcome-file>
    	</welcome-file-list>
    
    </web-app>
    security-conf.xml
    Code:
    <beans:beans xmlns="http://www.springframework.org/schema/beans"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:flex="http://www.springframework.org/schema/flex"
                 xmlns:beans="http://www.springframework.org/schema/beans"
                 xmlns:security="http://www.springframework.org/schema/security"
    			 xsi:schemaLocation="
    			    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                    http://www.springframework.org/schema/flex http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
                    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">
    
    
    	<security:http entry-point-ref="preAuthenticatedEntryPoint"/>
    
    	 <bean id="preAuthenticatedEntryPoint" class="org.springframework.security.ui.preauth.PreAuthenticatedProcessingFilterEntryPoint"/>
    
     	 <security:authentication-provider>
    		 <security:user-service>
    			 <security:user name="xxxx" password="xxxxxx" authorities="ROLE_USER"/>
    			 <security:user name="admin" password="yyyyy" authorities="ROLE_USER,ROLE_ADMIN"/>
    		 </security:user-service>
    	 </security:authentication-provider>
    
    	 <bean id="allExceptionTranslator" class="be.bianca.service.ExceptionTranslator"/>
    
    </beans:beans>

    flex-servlet.xml
    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:flex="http://www.springframework.org/schema/flex"
                 xmlns:beans="http://www.springframework.org/schema/beans"
                 xmlns:security="http://www.springframework.org/schema/security"
    			 xsi:schemaLocation="
    			    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                    http://www.springframework.org/schema/flex http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
                    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">
    
    	<import resource="classpath:be/bianca/service/service-context.xml"/>
    
        	<flex:message-broker services-config-path="/WEB-INF/services-config.xml">
    		<flex:exception-translator ref="allExceptionTranslator"/>
    		<flex:remoting-service default-channels="channel-amf-secure"/>
    		<flex:secured>
                <flex:secured-channel channel="channel-amf-secure" access="ROLE_ADMIN,ROLE_USER"/>
    		</flex:secured>
    	</flex:message-broker>
    
    </beans>
    services-config.xml
    Code:
    <services-config>
    
        <services>
            <service id="remoting-service" class="flex.messaging.services.RemotingService">
                <adapters>
                    <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter"
                                        default="true"/>
                </adapters>
                <default-channels>
                    <channel ref="channel-amf-secure"/>
    			</default-channels>
            </service>
        </services>
    
        <channels>
            <channel-definition id="channel-amf-secure" class="mx.messaging.channels.SecureAMFChannel">
                <endpoint url="https://{server.name}:8443/{context.root}/messagebroker/amf"
                          class="flex.messaging.endpoints.SecureAMFEndpoint"/>
                <properties>
                    <polling-enabled>false</polling-enabled>
                    <login-after-disconnect>true</login-after-disconnect>
                    <serialization>
                        <log-property-errors>true</log-property-errors>
                    </serialization>
                </properties>
            </channel-definition>
        </channels>
    
        <logging>
            <target class="flex.messaging.log.ConsoleTarget" level="Warn">
                <properties>
                    <prefix>[BlazeDS] </prefix>
                    <includeDate>true</includeDate>
                    <includeTime>true</includeTime>
                    <includeLevel>true</includeLevel>
                    <includeCategory>true</includeCategory>
                </properties>
                <filters>
                    <pattern>Endpoint.*</pattern>
                    <pattern>Service.*</pattern>
                    <pattern>Message.*</pattern>
                    <pattern>DataService.*</pattern>
                    <pattern>Configuration</pattern>
                </filters>
            </target>
        </logging>
    
        <system>
            <redeploy>
                <enabled>true</enabled>
                <watch-interval>20</watch-interval>
                <watch-file>{context.root}/WEB-INF/flex-servlet.xml</watch-file>
                <touch-file>{context.root}/WEB-INF/web.xml</touch-file>
            </redeploy>
        </system>
    
    </services-config>

  4. #4
    Join Date
    Dec 2009
    Posts
    4

    Default

    service-context.xml
    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	   xmlns:context="http://www.springframework.org/schema/context"
    	   xmlns:tx="http://www.springframework.org/schema/tx"
    	   xmlns:util="http://www.springframework.org/schema/util"
    	   xmlns:aop="http://www.springframework.org/schema/aop"
    	   xsi:schemaLocation="
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
                http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
    
    	<!-- setting this attribute to true will make sure the Cobertura coverage report can properly be generated -->
    	<aop:config proxy-target-class="true"/>
    
    	<context:annotation-config/>
    
    	<!-- business beans are auto-detected and configured, see @Repository and @Service annotations -->
    
    	<context:component-scan base-package="be.bianca.service">
    		<context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
    		<context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/>
    	</context:component-scan>
    
    	<!-- non-business configuration: transactionality and persistence -->
    
    	<tx:annotation-driven transaction-manager="transactionManager"/>
    
    	<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
    
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory"/>
    	</bean>
    
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    		<property name="packagesToScan">
    			<list>
    				<value>be.bianca.service.model</value>
    			</list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.connection.autocommit">false</prop>
    				<!-- 1=read uncommitted, 2=read committed, 4=repeatable read, 8=serializable  -->
    				<prop key="hibernate.connection.isolation">2</prop>
    				<prop key="hibernate.jdbc.fetch_size">8</prop>
    				<prop key="hibernate.default_batch_fetch_size">8</prop>
    				<prop key="hibernate.show_sql">false</prop>
    				<!--<prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>-->
    				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
    				<prop key="hibernate.hbm2ddl.auto">create</prop>
    			</props>
    		</property>
    		<property name="dataSource">
    			<bean class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
    				<property name="defaultAutoCommit" value="false"/>
    				<property name="targetDataSource">
    					<bean class="org.apache.commons.dbcp.BasicDataSource">
    						<property name="defaultAutoCommit" value="false"/>
    						<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    						<property name="url" value="jdbc:mysql://localhost/bianca"/>
    						<property name="username" value="xxxxx"/>
    						<!--<property name="driverClassName" value="org.h2.Driver"/>-->
    						<!--<property name="url" value="jdbc:h2:mem:."/>-->
    						<!--<property name="username" value="sa"/>-->
    						<property name="password" value="xxxxxx"/>
    						<property name="initialSize" value="2"/>
    						<property name="maxActive" value="10"/>
    						<property name="maxWait" value="1800"/>
    						<property name="maxOpenPreparedStatements" value="50"/>
    					</bean>
    				</property>
    			</bean>
    		</property>
    	</bean>
    
    </beans>

  5. #5

    Default

    Ok, so the first thing I would try is to make a "flex" folder at the same level as the flex-servlet.xml. Then put the services-config.xml in it. You should not need to reference it in the flex-servlet.xml.

    Also try adding all the other channels to the services-config.xml and see if you still get the problem.

    I don't see any flex:RemotingDestinations in your flex-servlet. And where are you declaring your "destination beans" that you can't access? You can put those in the flex-servlet too.

    I would also put the hibernate stuff that is in the services-context, in it's own file and then import it into the flex-servlet, or you can just put it in there directly.

    You may want to try the whole thing without Security first and then turn on security after it works. As for Security don't forget to set the "Connector SSLEnabled" in the tomcat server.xml in your windows machine.

    Just some ideas, let us know how it goes.

    Joshua
    Last edited by javajoshw; Dec 13th, 2009 at 10:27 PM.

  6. #6
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    If your destination beans are getting destroyed, you must be getting an error and a stack trace somewhere. The stack trace would greatly help in pinpointing your problem.
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

  7. #7
    Join Date
    Dec 2009
    Posts
    4

    Default

    Issue resolved.

    For some kind of weird reason, tomcat deployed my war twice.

    Thanks to Joshua to try help me out.

  8. #8
    Join Date
    Sep 2009
    Posts
    16

    Default Similar thing happening with me

    Hello bram_bba, Similar thing is happening with me and my app is getting redeployed in tomcat after session time out.
    Could you tell me how did you resolve this issue, or stop tomcat redeploying the app after session expires. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •