使用ssh编写了一web application ,正常运行。
在根包中建立一个类,编写public static void main(String args「」),
ApplicationContext ct=new ClassPathXmlApplicationContext("applicationContext.xml");产生异常,请问是什么原因,谢谢Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\Devcode\Workspaces\enjoyphoto\enjoyphoto\WebRoot\WEB-INF\applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
at com.xgl.st.StartMain.main(StartMain.java:11)
Caused by: java.lang.reflect.MalformedParameterizedTypeException
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:42)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:35)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:77)
at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:86)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:122)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:82)
at java.lang.Class.getGenericInterfaces(Class.java:794)
at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:161)
at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:99)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:88)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
... 14
在根包中建立一个类,编写public static void main(String args「」),
ApplicationContext ct=new ClassPathXmlApplicationContext("applicationContext.xml");产生异常,请问是什么原因,谢谢Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\Devcode\Workspaces\enjoyphoto\enjoyphoto\WebRoot\WEB-INF\applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
at com.xgl.st.StartMain.main(StartMain.java:11)
Caused by: java.lang.reflect.MalformedParameterizedTypeException
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:42)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:35)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:77)
at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:86)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:122)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:82)
at java.lang.Class.getGenericInterfaces(Class.java:794)
at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:161)
at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:99)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:88)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
... 14
解决方案 »
- 关于jsp页面注册,用jquery验证的几点问题?
- 请问有人做过西班牙语后台吗
- 新手初学,求J2EE项目源码研究
- 谁知道在Myeclipse中怎么去掉jsp的焦点提示功能?
- 下载的ssh源代码,请问怎么才能知道index.JSP界面的用户名和密码
- ◆◇jsp调用javabean时提示找不到该bean!!!怎么解决??◇◆
- 数据结构方面的面试题目
- Standalone 如何翻译?
- 怎么设置一个虚拟目录?
- 我在网页中修改已有的记录内容,为什么clob字段中的内容如果添加一些字符串,没有问题,可以删除一部分内容使该字段内容变短,就有问题
- java程序员,打算往大web 和电商方向发展,需要重点学习哪些东西呢?
- 请教高手一个字节数组的问题!!!!!
你启动webServer了么
他没有创建成功这个bean
web--->struts2--->spring--->hibernate-->database.
修改为:
rich client app--->spring--->hibernate--->database.
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/enjoyphoto">
</property>
<property name="username" value="root"></property>
<property name="password" value="888888"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/xgl/pojo/SysAppmoduleAccess.hbm.xml</value>
<value>com/xgl/pojo/SysRole.hbm.xml</value>
<value>com/xgl/pojo/TblComment.hbm.xml</value>
<value>com/xgl/pojo/TblPhoto.hbm.xml</value>
<value>com/xgl/pojo/TblPkg.hbm.xml</value>
<value>com/xgl/pojo/TblUser.hbm.xml</value></list>
</property></bean>
<bean id="SysAppmoduleAccessDAO"
class="com.xgl.dao.SysAppmoduleAccessDAO" scope="prototype">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<bean id="SysRoleDAO" class="com.xgl.dao.SysRoleDAO" scope="prototype">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="TblCommentDAO" class="com.xgl.dao.TblCommentDAO" scope="prototype">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="TblPhotoDAO" class="com.xgl.dao.TblPhotoDAO" scope="prototype">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="TblPkgDAO" class="com.xgl.dao.TblPkgDAO" scope="prototype">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="TblUserDAO" class="com.xgl.dao.TblUserDAO" scope="prototype">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- service -->
<bean id="ListPkgService" class="com.xgl.services.ListPkgService" scope="prototype">
<property name="pkgDAO">
<ref bean="TblPkgDAO" />
</property>
</bean>
<bean id="ListPhotosService" class="com.xgl.services.ListPhotosService" scope="prototype">
<property name="pkgDAO">
<ref bean="TblPkgDAO" />
</property>
<property name="photoDAO">
<ref bean="TblPhotoDAO" />
</property>
</bean>
<bean id="ShowDetailsService" class="com.xgl.services.ShowDetailsService" scope="prototype">
<property name="pkgDAO">
<ref bean="TblPkgDAO" />
</property>
<property name="photoDAO">
<ref bean="TblPhotoDAO" />
</property>
<property name="commentDAO">
<ref bean="TblCommentDAO" />
</property>
</bean>
<bean id="CommentService" class="com.xgl.services.CommentService" scope="prototype">
<property name="commentDAO">
<ref bean="TblCommentDAO" />
</property>
</bean>
<!-- action -->
<bean id="ListPkg" class="com.xgl.action.ListPkg" scope="prototype">
<property name="listPkgService">
<ref bean="ListPkgService" />
</property>
</bean>
<bean id="ListPhotos" class="com.xgl.action.ListPhotos" scope="prototype">
<property name="listPhotosService">
<ref bean="ListPhotosService" />
</property>
</bean>
<bean id="ShowDetails" class="com.xgl.action.ShowDetails" scope="prototype">
<property name="listPhotosService">
<ref bean="ListPhotosService" />
</property>
<property name="showDetailsService">
<ref bean="ShowDetailsService" />
</property>
<property name="commentService">
<ref bean="CommentService" />
</property>
</bean>
<bean id="WriteComment" class="com.xgl.action.WriteComment" scope="prototype">
<property name="commentService">
<ref bean="CommentService" />
</property>
<property name="showDetailsService">
<ref bean="ShowDetailsService" />
</property>
</bean>
</beans>