Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.43 KB | None | 0 0
  1. Type Exception Report
  2.  
  3. Message Request processing failed; nested exception is java.lang.IllegalStateException: The mapped controller method class 'eventOrganizer.dao.impl.DBEventImpl' is not an instance of the actual controller bean instance 'com.sun.proxy.$Proxy69'. If the controller requires proxying (e.g. due to @Transactional), please use class-based proxying.
  4.  
  5. Description The server encountered an unexpected condition that prevented it from fulfilling the request.
  6.  
  7. Exception
  8.  
  9. org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: The mapped controller method class 'eventOrganizer.dao.impl.DBEventImpl' is not an instance of the actual controller bean instance 'com.sun.proxy.$Proxy69'. If the controller requires proxying (e.g. due to @Transactional), please use class-based proxying.
  10. HandlerMethod details:
  11. Controller [com.sun.proxy.$Proxy69]
  12. Method [public java.util.List<eventOrganizer.entities.Event> eventOrganizer.dao.impl.DBEventImpl.getEvent()]
  13. Resolved arguments:
  14.  
  15. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
  16. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
  17. javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
  18. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
  19. javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  20. org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
  21. Root Cause
  22.  
  23. java.lang.IllegalStateException: The mapped controller method class 'eventOrganizer.dao.impl.DBEventImpl' is not an instance of the actual controller bean instance 'com.sun.proxy.$Proxy69'. If the controller requires proxying (e.g. due to @Transactional), please use class-based proxying.
  24. HandlerMethod details:
  25. Controller [com.sun.proxy.$Proxy69]
  26. Method [public java.util.List<eventOrganizer.entities.Event> eventOrganizer.dao.impl.DBEventImpl.getEvent()]
  27. Resolved arguments:
  28.  
  29. org.springframework.web.method.support.InvocableHandlerMethod.assertTargetBean(InvocableHandlerMethod.java:261)
  30. org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:224)
  31. org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  32. org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
  33. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
  34. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
  35. org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  36. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
  37. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
  38. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
  39. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
  40. javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
  41. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
  42. javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  43. org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
  44. Note The full stack trace of the root cause is available in the server logs.
  45.  
  46. <?xml version='1.0' encoding='utf-8'?>
  47. <!DOCTYPE hibernate-configuration PUBLIC
  48. "-//Hibernate/Hibernate Configuration DTD//EN"
  49. "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
  50. <hibernate-configuration>
  51. <session-factory>
  52. <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  53. <property name="connection.url">jdbc:mysql://localhost:3306/eventorganizer</property>
  54. <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  55. <property name="hibernate.show_sql">true</property>
  56.  
  57. <property name="hibernate.connection.username">root</property>
  58. <property name="hibernate.connection.password">root</property>
  59.  
  60. <mapping resource="eventOrganizer/entities/Client.hbm.xml"/>
  61. <mapping resource="eventOrganizer/entities/Event.hbm.xml"/>
  62. <mapping resource="eventOrganizer/entities/GenreEvent.hbm.xml"/>
  63. <mapping resource="eventOrganizer/entities/PlaceEvent.hbm.xml"/>
  64. <mapping resource="eventOrganizer/entities/User.hbm.xml"/>
  65.  
  66. </session-factory>
  67. </hibernate-configuration>
  68.  
  69. <!DOCTYPE web-app PUBLIC
  70. "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  71. "http://java.sun.com/dtd/web-app_2_3.dtd" >
  72.  
  73. <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  74. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  75. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  76. version="3.1">
  77. <display-name>Archetype Created Web Application</display-name>
  78. <servlet>
  79. <servlet-name>dispatcher</servlet-name>
  80. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  81. <init-param>
  82. <param-name>contextConfigLocation</param-name>
  83. <param-value>WEB-INF/config/dispatcher-servlet.xml</param-value>
  84. </init-param>
  85. <load-on-startup>1</load-on-startup>
  86. </servlet>
  87. <servlet-mapping>
  88. <servlet-name>dispatcher</servlet-name>
  89. <url-pattern>/</url-pattern>
  90. </servlet-mapping>
  91.  
  92. <welcome-file-list>
  93. <welcome-file>index.jsp</welcome-file>
  94. </welcome-file-list>
  95. </web-app>
  96.  
  97. <?xml version="1.0" encoding="UTF-8"?>
  98. <beans xmlns="http://www.springframework.org/schema/beans"
  99. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  100. xmlns:mvc="http://www.springframework.org/schema/mvc"
  101. xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
  102.  
  103. xsi:schemaLocation="http://www.springframework.org/schema/beans
  104. http://www.springframework.org/schema/beans/spring-beans.xsd
  105. http://www.springframework.org/schema/mvc
  106. http://www.springframework.org/schema/mvc/spring-mvc.xsd
  107. http://www.springframework.org/schema/context
  108. http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
  109. <mvc:annotation-driven/>
  110.  
  111. <mvc:resources mapping="/resources/**" location="/resources/"/>
  112.  
  113. <context:component-scan base-package="eventOrganizer"/>
  114. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  115. <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
  116. <property name="prefix" value="/WEB-INF/views/"/>
  117. <property name="suffix" value=".jsp"/>
  118. </bean>
  119.  
  120. <bean id="msg" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
  121. <property name="basename" value="/WEB-INF/locales/messages"/>
  122. <property name="defaultEncoding" value="UTF-8"/>
  123. </bean>
  124.  
  125. <bean id="localResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
  126. <property name="defaultLocale" value="ru"/>
  127. </bean>
  128.  
  129. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  130. <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
  131. <property name="prefix" value="/WEB-INF/views/"/>
  132. <property name="suffix" value=".jsp"/>
  133. </bean>
  134.  
  135. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  136. <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
  137. <property name="url" value="jdbc:mysql://localhost/"/>
  138. <property name="username" value="root"/>
  139. <property name="password" value="root"/>
  140. </bean>
  141.  
  142. <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
  143. <property name="dataSource" ref="dataSource"/>
  144. <!--Настройки sessionFactory берем из файла hibernate.cfg.xml, хотя можно здесь прописать самим-->
  145. <property name="configLocation" value="classpath:hibernate.cfg.xml"/>
  146. </bean>
  147.  
  148. <tx:annotation-driven/>
  149. <bean id="transactionManager"
  150. class="org.springframework.orm.hibernate4.HibernateTransactionManager">
  151. <property name="sessionFactory" ref="sessionFactory"/>
  152. </bean>
  153. </beans>
  154.  
  155. package eventOrganizer.dao.impl;
  156.  
  157. import eventOrganizer.dao.interfaces.EventDAO;
  158. import eventOrganizer.entities.Client;
  159. import eventOrganizer.entities.Event;
  160. import eventOrganizer.entities.GenreEvent;
  161. import org.hibernate.Session;
  162. import org.hibernate.SessionFactory;
  163. import org.springframework.beans.factory.annotation.Autowired;
  164. import org.springframework.stereotype.Repository;
  165. import org.springframework.transaction.annotation.Transactional;
  166. import org.springframework.web.bind.annotation.RequestMapping;
  167.  
  168. import javax.persistence.Query;
  169. import javax.persistence.criteria.CriteriaBuilder;
  170. import javax.persistence.criteria.CriteriaQuery;
  171. import javax.persistence.criteria.Root;
  172. import java.util.List;
  173.  
  174. import static org.springframework.web.bind.annotation.RequestMethod.GET;
  175.  
  176. @Repository
  177. @RequestMapping(value = "/event")
  178.  
  179. @Transactional
  180. public class DBEventImpl implements EventDAO {
  181. @Autowired
  182. private SessionFactory sessionFactory;
  183. private List<Event> events;
  184.  
  185. @RequestMapping(value = "/all", method = GET)
  186. @Override
  187. public List<Event> getEvent() {
  188.  
  189. Session session = sessionFactory.getCurrentSession();
  190. session.beginTransaction();
  191. CriteriaBuilder builder = session.getCriteriaBuilder();
  192. CriteriaQuery criteriaQuery = builder.createQuery(Event.class);
  193. Root<Event> root = criteriaQuery.from(Event.class);
  194. criteriaQuery.select(root);
  195. Query query = session.createQuery(criteriaQuery);
  196. events = query.getResultList();
  197.  
  198. return events;
  199. }
  200.  
  201. public List<Event> getEvent(Client client) {
  202. return null;
  203. }
  204.  
  205. public List<Event> getEvent(String eventName) {
  206. return null;
  207. }
  208.  
  209. public List<Event> getEvent(GenreEvent genreEvent) {
  210. return null;
  211. }
  212.  
  213. public List<Event> getEvent(Character letter) {
  214. return null;
  215. }
  216. }
  217.  
  218. package eventOrganizer.entities;
  219.  
  220. import java.sql.Timestamp;
  221. import java.util.Arrays;
  222.  
  223.  
  224. public class Event {
  225. private int id;
  226. private String name;
  227. private int genreId;
  228. private int clientId;
  229. private int placeId;
  230. private Timestamp date;
  231. private Timestamp timeBegin;
  232. private Timestamp timeDuration;
  233. private String source;
  234. private byte[] image;
  235. private String description;
  236. private Integer rating;
  237. private String voteCount;
  238. private byte[] content;
  239.  
  240. public int getId() {
  241. return id;
  242. }
  243.  
  244. public void setId(int id) {
  245. this.id = id;
  246. }
  247.  
  248. public String getName() {
  249. return name;
  250. }
  251.  
  252. public void setName(String name) {
  253. this.name = name;
  254. }
  255.  
  256. public int getGenreId() {
  257. return genreId;
  258. }
  259.  
  260. public void setGenreId(int genreId) {
  261. this.genreId = genreId;
  262. }
  263.  
  264. public int getClientId() {
  265. return clientId;
  266. }
  267.  
  268. public void setClientId(int clientId) {
  269. this.clientId = clientId;
  270. }
  271.  
  272. public int getPlaceId() {
  273. return placeId;
  274. }
  275.  
  276. public void setPlaceId(int placeId) {
  277. this.placeId = placeId;
  278. }
  279.  
  280. public Timestamp getDate() {
  281. return date;
  282. }
  283.  
  284. public void setDate(Timestamp date) {
  285. this.date = date;
  286. }
  287.  
  288. public Timestamp getTimeBegin() {
  289. return timeBegin;
  290. }
  291.  
  292. public void setTimeBegin(Timestamp timeBegin) {
  293. this.timeBegin = timeBegin;
  294. }
  295.  
  296. public Timestamp getTimeDuration() {
  297. return timeDuration;
  298. }
  299.  
  300. public void setTimeDuration(Timestamp timeDuration) {
  301. this.timeDuration = timeDuration;
  302. }
  303.  
  304. public String getSource() {
  305. return source;
  306. }
  307.  
  308. public void setSource(String source) {
  309. this.source = source;
  310. }
  311.  
  312. public byte[] getImage() {
  313. return image;
  314. }
  315.  
  316. public void setImage(byte[] image) {
  317. this.image = image;
  318. }
  319.  
  320. public String getDescription() {
  321. return description;
  322. }
  323.  
  324. public void setDescription(String description) {
  325. this.description = description;
  326. }
  327.  
  328. public Integer getRating() {
  329. return rating;
  330. }
  331.  
  332. public void setRating(Integer rating) {
  333. this.rating = rating;
  334. }
  335.  
  336. public String getVoteCount() {
  337. return voteCount;
  338. }
  339.  
  340. public void setVoteCount(String voteCount) {
  341. this.voteCount = voteCount;
  342. }
  343.  
  344. public byte[] getContent() {
  345. return content;
  346. }
  347.  
  348. public void setContent(byte[] content) {
  349. this.content = content;
  350. }
  351.  
  352. @Override
  353. public boolean equals(Object o) {
  354. if (this == o) return true;
  355. if (o == null || getClass() != o.getClass()) return false;
  356.  
  357. Event event = (Event) o;
  358.  
  359. if (id != event.id) return false;
  360. if (genreId != event.genreId) return false;
  361. if (clientId != event.clientId) return false;
  362. if (placeId != event.placeId) return false;
  363. if (name != null ? !name.equals(event.name) : event.name != null) return false;
  364. if (date != null ? !date.equals(event.date) : event.date != null) return false;
  365. if (timeBegin != null ? !timeBegin.equals(event.timeBegin) : event.timeBegin != null) return false;
  366. if (timeDuration != null ? !timeDuration.equals(event.timeDuration) : event.timeDuration != null) return false;
  367. if (source != null ? !source.equals(event.source) : event.source != null) return false;
  368. if (!Arrays.equals(image, event.image)) return false;
  369. if (description != null ? !description.equals(event.description) : event.description != null) return false;
  370. if (rating != null ? !rating.equals(event.rating) : event.rating != null) return false;
  371. if (voteCount != null ? !voteCount.equals(event.voteCount) : event.voteCount != null) return false;
  372. if (!Arrays.equals(content, event.content)) return false;
  373.  
  374. return true;
  375. }
  376.  
  377. @Override
  378. public int hashCode() {
  379. int result = id;
  380. result = 31 * result + (name != null ? name.hashCode() : 0);
  381. result = 31 * result + genreId;
  382. result = 31 * result + clientId;
  383. result = 31 * result + placeId;
  384. result = 31 * result + (date != null ? date.hashCode() : 0);
  385. result = 31 * result + (timeBegin != null ? timeBegin.hashCode() : 0);
  386. result = 31 * result + (timeDuration != null ? timeDuration.hashCode() : 0);
  387. result = 31 * result + (source != null ? source.hashCode() : 0);
  388. result = 31 * result + Arrays.hashCode(image);
  389. result = 31 * result + (description != null ? description.hashCode() : 0);
  390. result = 31 * result + (rating != null ? rating.hashCode() : 0);
  391. result = 31 * result + (voteCount != null ? voteCount.hashCode() : 0);
  392. result = 31 * result + Arrays.hashCode(content);
  393. return result;
  394. }
  395. }
  396.  
  397. <?xml version='1.0' encoding='utf-8'?>
  398. <!DOCTYPE hibernate-mapping PUBLIC
  399. "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  400. "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
  401. <hibernate-mapping>
  402.  
  403. <class name="eventOrganizer.entities.Event" table="event" schema="eventorganizer">
  404. <id name="id" column="id"/>
  405. <property name="name" column="name"/>
  406. <property name="genreId" column="genre_id"/>
  407. <property name="clientId" column="client_id"/>
  408. <property name="placeId" column="place_id"/>
  409. <property name="date" column="date"/>
  410. <property name="timeBegin" column="timeBegin"/>
  411. <property name="timeDuration" column="timeDuration"/>
  412. <property name="source" column="source"/>
  413. <property name="image" column="image"/>
  414. <property name="description" column="description"/>
  415. <property name="rating" column="rating"/>
  416. <property name="voteCount" column="voteCount"/>
  417. <property name="content" column="content"/>
  418. </class>
  419. </hibernate-mapping>
  420.  
  421. <?xml version="1.0" encoding="UTF-8"?>
  422. <project xmlns="http://maven.apache.org/POM/4.0.0"
  423. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  424. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  425. <modelVersion>4.0.0</modelVersion>
  426.  
  427. <groupId>groupId</groupId>
  428. <artifactId>EventOrganizer</artifactId>
  429. <version>1.0-SNAPSHOT</version>
  430. <build>
  431. <plugins>
  432. <plugin>
  433. <groupId>org.apache.maven.plugins</groupId>
  434. <artifactId>maven-compiler-plugin</artifactId>
  435. <configuration>
  436. <source>1.6</source>
  437. <target>1.6</target>
  438. </configuration>
  439. </plugin>
  440. </plugins>
  441. </build>
  442. <packaging>war</packaging>
  443.  
  444. <properties>
  445. <webflow-version>2.4.1.RELEASE</webflow-version>
  446. <spring-framework-version>4.1.5.RELEASE</spring-framework-version>
  447. <springsecurity-version>3.2.6.RELEASE</springsecurity-version>
  448. <slf4j-version>1.6.1</slf4j-version>
  449. <mojarra-version>2.2.10</mojarra-version>
  450. <primefaces-version>5.1</primefaces-version>
  451. <hibernate-version>5.2.12.Final</hibernate-version>
  452. <mysqlconnector-version>5.1.37</mysqlconnector-version>
  453. </properties>
  454.  
  455.  
  456. <dependencyManagement>
  457. <dependencies>
  458. <dependency>
  459. <groupId>org.springframework</groupId>
  460. <artifactId>spring-framework-bom</artifactId>
  461. <version>${spring-framework-version}</version>
  462. <type>pom</type>
  463. <scope>import</scope>
  464. </dependency>
  465. </dependencies>
  466. </dependencyManagement>
  467.  
  468.  
  469. <dependencies>
  470. <!--Spring-->
  471. <dependency>
  472. <groupId>org.springframework</groupId>
  473. <artifactId>spring-aop</artifactId>
  474. </dependency>
  475. <dependency>
  476. <groupId>org.springframework</groupId>
  477. <artifactId>spring-context</artifactId>
  478. </dependency>
  479. <dependency>
  480. <groupId>org.springframework</groupId>
  481. <artifactId>spring-jdbc</artifactId>
  482. </dependency>
  483. <dependency>
  484. <groupId>org.springframework</groupId>
  485. <artifactId>spring-orm</artifactId>
  486. </dependency>
  487. <dependency>
  488. <groupId>org.springframework</groupId>
  489. <artifactId>spring-webmvc</artifactId>
  490. </dependency>
  491. <dependency>
  492. <groupId>org.springframework</groupId>
  493. <artifactId>spring-web</artifactId>
  494. </dependency>
  495.  
  496. <dependency>
  497. <groupId>org.springframework.security</groupId>
  498. <artifactId>spring-security-web</artifactId>
  499. <version>${springsecurity-version}</version>
  500. </dependency>
  501. <dependency>
  502. <groupId>org.springframework.security</groupId>
  503. <artifactId>spring-security-config</artifactId>
  504. <version>${springsecurity-version}</version>
  505. </dependency>
  506.  
  507.  
  508. <dependency>
  509. <groupId>org.slf4j</groupId>
  510. <artifactId>slf4j-api</artifactId>
  511. <version>${slf4j-version}</version>
  512. </dependency>
  513. <dependency>
  514. <groupId>org.slf4j</groupId>
  515. <artifactId>jcl-over-slf4j</artifactId>
  516. <version>${slf4j-version}</version>
  517. </dependency>
  518. <dependency>
  519. <groupId>org.slf4j</groupId>
  520. <artifactId>slf4j-log4j12</artifactId>
  521. <version>${slf4j-version}</version>
  522. <scope>runtime</scope>
  523. </dependency>
  524.  
  525.  
  526. <dependency>
  527. <groupId>log4j</groupId>
  528. <artifactId>log4j</artifactId>
  529. <version>1.2.15</version>
  530. <exclusions>
  531. <exclusion>
  532. <groupId>javax.mail</groupId>
  533. <artifactId>mail</artifactId>
  534. </exclusion>
  535. <exclusion>
  536. <groupId>javax.jms</groupId>
  537. <artifactId>jms</artifactId>
  538. </exclusion>
  539. <exclusion>
  540. <groupId>com.sun.jdmk</groupId>
  541. <artifactId>jmxtools</artifactId>
  542. </exclusion>
  543. <exclusion>
  544. <groupId>com.sun.jmx</groupId>
  545. <artifactId>jmxri</artifactId>
  546. </exclusion>
  547. </exclusions>
  548. <scope>runtime</scope>
  549. </dependency>
  550.  
  551. <dependency>
  552. <groupId>javax.servlet</groupId>
  553. <artifactId>javax.servlet-api</artifactId>
  554. <version>3.0.1</version>
  555. <scope>provided</scope>
  556. </dependency>
  557.  
  558. <dependency>
  559. <groupId>jstl</groupId>
  560. <artifactId>jstl</artifactId>
  561. <version>1.2</version>
  562. </dependency>
  563.  
  564.  
  565. <!--Hibernate and MySQL-->
  566. <dependency>
  567. <groupId>org.hibernate</groupId>
  568. <artifactId>hibernate-core</artifactId>
  569. <version>${hibernate-version}</version>
  570. </dependency>
  571. <dependency>
  572. <groupId>mysql</groupId>
  573. <artifactId>mysql-connector-java</artifactId>
  574. <version>${mysqlconnector-version}</version>
  575. </dependency>
  576. </dependencies>
  577. </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement