无法在模块java.lang.OutOfMemoryError中定义类org.springframework.web.context.ContextLoader:PermGen空间

时间:2014-09-22 11:20:47

标签: java spring hibernate spring-mvc jboss

<context:annotation-config />
	<context:component-scan base-package="com.lv.rs.accessautomation.view.controller" />
	<mvc:annotation-driven />
	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/pages/" />
		<property name="suffix" value=".jsp" />
	</bean>
	<mvc:resources mapping="/scripts/**" location="/scripts/" />
	<mvc:resources location="/style/style.css" mapping="/style/**" />
	<mvc:resources mapping="/images/**" location="/images/" />


	<!-- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" /> -->
    <bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close"> 
        
        <property name="URL" value="jdbc:oracle:thin:@sam123:1521:sam123" /> 
        <property name="user" value="sample"/> 
        <property name="password" value="Pass1234"/> 
        <property name="connectionCachingEnabled" value="true"/> 
    </bean>


	<bean id="ressessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource">
			<ref bean="dataSource" />
		</property>
		<property name="hibernateProperties">
			<props>
				<!-- <prop key="hibernate.connection.datasource">java:jboss/OracleDS/RESGlobaldata</prop>
				<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
				<prop key="connection.pool_size">1</prop>
				<prop key="hibernate.show_sql">true</prop> -->


				   <prop key="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</prop> 
					
					<prop key="hibernate.default_schema">resources</prop> 
					<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> 
					<prop key="connection.pool_size">1</prop> 
					<prop key="hibernate.show_sql">true</prop> 
					<prop key="hibernate.hbm2ddl.auto">create</prop> 
			</props>
		</property>
		<property name="annotatedClasses">
			<list>
				<value>com.sample.pvo</value>
				<value>com.sample.rsvo</value>
			</list>
		</property>
	</bean>
	
    <tx:annotation-driven />
	<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager" id="transactionManager">
		<property name="sessionFactory" ref="ressessionFactory"></property>
	</bean>

	
如果我在jboss服务器中部署war [spring + Hibernate applicatiob],我会得到以下异常。 我得到这个错误agter进行数据库调用。是因为会话没有正确关闭?春天servlet.xml会不会照顾它?

18:47:05,404 WARN  [org.jboss.modules] (MSC service thread 1-1) Failed to define class org.springframework.expression.Expression in Module "deployment.RSAccessMgmt.war:main" from Service Module Loader: java.lang.OutOfMemoryError: PermGen space
	at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_07]
	at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_07]
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_07]
	at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
	at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_07]
	at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.7.0_07]
	at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.7.0_07]
	at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
	at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
	at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
	at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
	at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]

18:47:08,436 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."RSAccessMgmt.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."RSAccessMgmt.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "RSAccessMgmt.war"
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
	at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
Caused by: java.lang.RuntimeException: Error getting reflective information for class org.springframework.web.servlet.tags.EvalTag with ClassLoader ModuleClassLoader for Module "deployment.RSAccessMgmt.war:main" from Service Module Loader
	at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
	at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
	at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
	at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	... 5 more
Caused by: java.lang.NoClassDefFoundError: Lorg/springframework/expression/Expression;
	at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_07]
	at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.7.0_07]
	at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.7.0_07]
	at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
	... 10 more

0 个答案:

没有答案