如果有人能解决我的问题,我将不胜感激。我搜索并发现了很多类似的问题。但无法找到解决方案。我为提出同样的问题而道歉。但我对这个问题感到挣扎和沮丧。
我有一个web应用程序,在eclipse上部署了许多项目。我正在使用spring框架。一切都很好。我在eclipse中清理了所有项目,然后启动了服务器。我的浏览器抛出了这个错误。我试图重启服务器和所有可能的修复但没有任何效果。
SEVERE: Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class[org.company.ain.authenticate.AuthenticateUser] for bean with name 'authenticate'
这是我的.xml文件
<bean name="authenticate" class="org.company.ain.authenticate.AuthenticateUser">
<property name="dataSource" ref="dataSource"/>
</bean>
我想知道两件事。
答案 0 :(得分:0)
我的工作示例是多次休眠,我希望它对您有用。
数据来源
<!-- DATA SOURCE -->
<bean id="_dataSourceProxy"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="resourceRef" value="true" />
<property name="jndiName" value="${connection.jndiName}"></property>
<property name="lookupOnStartup" value="false"></property>
<property name="cache" value="false"></property>
<property name="proxyInterface" value="javax.sql.DataSource"></property>
</bean>
休眠
<!-- HIBERNATE -->
<bean id="_hibernateSessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="_dataSourceProxy"></ref>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.connection.SetBigStringTryClob">true</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
<prop key="hibernate.jdbc.use_streams_for_binary">false</prop>
<prop key="javax.persistence.validation.mode">none</prop>
<prop key="connection.useUnicode">true</prop>
<prop key="connection.characterEncoding">utf-8</prop>
<prop key="hibernate.connection.defaultNChar">true</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>hibernate/content/Content.hbm.xml</value>
<value>hibernate/content/ContentMeta.hbm.xml</value>
</list>
</property>
</bean>
Hibernate Conf for multi
<!-- Content Repo -->
<bean id="_contentRepository"
class="XXXX">
<aop:scoped-proxy/>
<property name="_senderEmail" value="${smtp.senderEmail}"></property>
<property name="_hibernateSessionFactory">
<ref bean="_hibernateSessionFactory"></ref>
</property>
<property name="_authService">
<ref bean="_authService"></ref>
</property>
<property name="_languageRepository">
<ref bean="_languageRepository"></ref>
</property>
<property name="_locationRepository">
<ref bean="_locationRepository"></ref>
</property>
<property name="_velocityEngine">
<ref bean="_velocityEngine"></ref>
</property>
<property name="_mailSender">
<ref bean="_mailSender"></ref>
</property>
</bean>
示例回购:
<!-- Location Repo -->
<bean id="_locationRepository"
class="XXXX">
<property name="_hibernateSessionFactory">
<ref bean="_hibernateSessionFactory"></ref>
</property>
</bean>