1
Jungs, die ich ein Projekt zu machen versuchen, die, Spring MVC und Feder Sicherheit haben winter ... aber wenn die Entitätszuordnung es produziert ClassNotFound Ausnahme ... hier ist mein CodeEinheit produziert ClassNotFound Ausnahme in Hibernate
MVC-Dispatcher-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
\t xmlns:context="http://www.springframework.org/schema/context"
\t xmlns:mvc="http://www.springframework.org/schema/mvc"
\t xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
\t xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:annotation-driven/>
\t <context:annotation-config />
\t
\t <context:component-scan base-package="com.mkyong.*" />
\t <bean
\t \t class="org.springframework.web.servlet.view.InternalResourceViewResolver">
\t \t <property name="prefix">
\t \t \t <value>/WEB-INF/pages/</value>
\t \t </property>
\t \t <property name="suffix">
\t \t \t <value>.jsp</value>
\t \t </property>
\t </bean>
</beans>
federDaten base.xml
<beans xmlns="http://www.springframework.org/schema/beans"
\t xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
\t xmlns:tx="http://www.springframework.org/schema/tx"
\t xsi:schemaLocation="http://www.springframework.org/schema/beans
\t http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
\t http://www.springframework.org/schema/aop
\t http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
\t http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
\t <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
\t \t destroy-method="close">
\t \t <property name="driverClassName" value="com.mysql.jdbc.Driver" />
\t \t <property name="url" value="jdbc:mysql://localhost:3306/test" />
\t \t <property name="username" value="root" />
\t \t <property name="password" value="root" />
\t </bean>
\t <bean id="sessionFactory"
\t \t class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
\t \t <property name="dataSource" ref="dataSource" />
\t \t <property name="annotatedClasses">
\t \t \t <list>
\t \t \t \t <value>com.mkyong.users.model.User</value>
\t \t \t \t <value>com.mkyong.users.model.UserRole</value>
\t \t \t </list>
\t \t </property>
\t \t <property name="hibernateProperties">
\t \t \t <props>
\t \t \t \t <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
\t \t \t \t <prop key="hibernate.format_sql">true</prop>
\t \t \t \t <prop key="hibernate.show_sql">true</prop>
\t \t \t </props>
\t \t </property>
\t </bean>
\t <bean id="userDao" class="com.mkyong.users.dao.UserDaoImpl">
\t \t <property name="sessionFactory" ref="sessionFactory" />
\t </bean>
\t <bean id="myUserDetailsService" class="com.mkyong.users.service.MyUserDetailsService">
\t \t <property name="userDao" ref="userDao" />
\t </bean>
\t <bean id="transactionManager"
\t \t class="org.springframework.orm.hibernate4.HibernateTransactionManager">
\t \t <property name="sessionFactory" ref="sessionFactory"></property>
\t </bean>
\t <tx:advice id="txAdvice" transaction-manager="transactionManager">
\t \t <tx:attributes>
\t \t \t <tx:method name="get*" read-only="true" />
\t \t \t <tx:method name="find*" read-only="true" />
\t \t \t <tx:method name="*" />
\t \t </tx:attributes>
\t </tx:advice>
\t <aop:config>
\t \t <aop:pointcut id="userServicePointCut"
\t \t \t expression="execution(* com.mkyong.users.service.*Service.*(..))" />
\t \t <aop:advisor advice-ref="txAdvice" pointcut-ref="userServicePointCut" />
\t </aop:config>
</beans>
die Ausnahme ist
java.lang.ClassNotFoundException: com.mkyong.users.model.User
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:255)
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:288)
whould jede Hilfe sehr geschätzt :)