我正在研究支付网关集成,而我一直停留在这一点上。我得到错误。我尝试了所有可能的解决方案,但无法继续。帮助我确定解决方案。 我有servlet-context.xml,其中我通过
导入pg-context.xml。
<beans:import resource="classpath:pg-context.xml" />
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pgService' defined in class path resource [pg-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.majesco.dcf.pg.service.PGService]: Specified class is an interface
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.majesco.dcf.pg.service.PGService]: Specified class is an interface
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:68)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1069)
... 31 more
SEVERE: Servlet [appServlet] in web application [/ABHI] threw load() exception
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.majesco.dcf.pg.service.PGService]: Specified class is an interface
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:68)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1069)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
我的pg-context.xml:
<!--context:component-scan base-package="com.majesco.dcf"/
<context:component-scan base-package="com.majesco.dcf.app.*" />
<beans:bean id="pgService" class="com.majesco.dcf.pg.service.PGService" />-->
<beans:bean id="pgService" class="com.majesco.dcf.pg.service.PGService" >
<beans:property name="pgService" ref="PGService" />
</beans:bean>
<beans:bean id="transactionManagerPG" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<beans:property name="dataSource" ref="dataSourcePG" />
<beans:property name="sessionFactory" ref="sessionFactoryPG" />
<beans:property name="hibernateManagedSession" value="false"/>
<!-- <beans:qualifier value="pg"/> -->
</beans:bean>
<beans:bean id="pgdbService" class="com.majesco.dcf.pg.service.PGDBService" >
<beans:property name="transactionManager" ref="transactionManagerPG" />
</beans:bean>
<beans:bean id="dataSourcePG"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="${jdbc.driverClassName}"
p:url="${jdbc.databaseurl}" p:username="${jdbc.pg_username}"
p:password="${jdbc.pg_password}" />
<beans:bean id="sessionFactoryPG"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<beans:property name="dataSource" ref="dataSourcePG" />
<beans:property name="configLocation">
<beans:value>classpath:pg.cfg.xml</beans:value>
</beans:property>
<beans:property name="hibernateProperties">
<beans:props>
<beans:prop key="hibernate.dialect">${jdbc.dialect}</beans:prop>
<beans:prop key="hibernate.show_sql">false</beans:prop>
<beans:prop key="hibernate.default_schema">${jdbc.pg_schema}</beans:prop>
<beans:prop key="hibernate.hbm2ddl.auto">${jdbc.hbm2ddl.auto}</beans:prop>
</beans:props>
</beans:property>
</beans:bean>
答案 0 :(得分:0)
In this file pg-context.xml , you define like below
<beans:bean id="pgService" class="com.majesco.dcf.pg.service.PGService" >
<beans:property name="pgService" ref="PGService" />
</beans:bean>
But where you are getting **ref="PGService"**? Is there any bean you define with name "PGService"?