java - ClassNotFoundException org.springframework.orm.hibernate4.support.OpenSessionInViewFilter -
i done solve own, searched on internet , nothing helped since then. building web application using java/spring/hibernate/tomcat and, @ session filter in web.xml, getting error:
java.lang.classnotfoundexception: org.springframework.orm.hibernate4.support.opensessioninviewfilter @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1333) @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1167) @ org.apache.catalina.core.defaultinstancemanager.loadclass(defaultinstancemanager.java:520) @ org.apache.catalina.core.defaultinstancemanager.loadclassmaybeprivileged(defaultinstancemanager.java:501) @ org.apache.catalina.core.defaultinstancemanager.newinstance(defaultinstancemanager.java:120) @ org.apache.catalina.core.applicationfilterconfig.getfilter(applicationfilterconfig.java:258) @ org.apache.catalina.core.applicationfilterconfig.<init>(applicationfilterconfig.java:105) @ org.apache.catalina.core.standardcontext.filterstart(standardcontext.java:4659) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5281) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1408) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1398) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745)
really not know fix this, @ config files:
my pom:
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>br.com.mobcube</groupid> <artifactid>amigooculto</artifactid> <packaging>war</packaging> <version>0.0.1-snapshot</version> <name>amigo oculto maven webapp</name> <url>http://maven.apache.org</url> <properties> <spring.version>4.1.6.release</spring.version> <hibernate.version>4.3.10.final</hibernate.version> <jersey.version>2.18</jersey.version> </properties>
<dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- servlet --> <dependency> <groupid>javax.servlet</groupid> <artifactid>javax.servlet-api</artifactid> <version>3.0.1</version> <scope>provided</scope> </dependency> <!-- mysql --> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.35</version> <scope>compile</scope> </dependency> <!-- jersey --> <dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-servlet</artifactid> <version>2.18</version> </dependency> <!-- google-gson --> <dependency> <groupid>com.google.code.gson</groupid> <artifactid>gson</artifactid> <version>2.3.1</version> </dependency> <!-- jersey-spring --> <dependency> <groupid>org.glassfish.jersey.ext</groupid> <artifactid>jersey-spring3</artifactid> <version>2.18</version> <exclusions> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> </exclusion> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> </exclusion> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> </exclusion> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-aop</artifactid> </exclusion> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-beans</artifactid> </exclusion> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-tx</artifactid> </exclusion> </exclusions> </dependency> <!-- spring --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-orm</artifactid> <version>${spring.version}</version> </dependency> <!-- hibernate --> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>${hibernate.version}</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-ehcache</artifactid> <version>${hibernate.version}</version> </dependency> <dependency> <groupid>commons-dbcp</groupid> <artifactid>commons-dbcp</artifactid> <version>1.4</version> </dependency> <!-- hibernate aspectj --> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjrt</artifactid> <version>1.6.11</version> </dependency> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjweaver</artifactid> <version>1.6.11</version> </dependency> <!-- jersey upload --> <dependency> <groupid>org.glassfish.jersey.media</groupid> <artifactid>jersey-media-multipart</artifactid> <version>${jersey.version}</version> </dependency> <!-- commons-io --> <dependency> <groupid>org.apache.commons</groupid> <artifactid>commons-io</artifactid> <version>1.3.2</version> </dependency>
<build> <finalname>amigo</finalname> <plugins> <!-- compiler --> <plugin> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.8</source> <target>1.8</target> <encoding>utf-8</encoding> </configuration> </plugin> </plugins> </build>
my web.xml:
<?xml version="1.0" encoding="utf-8"?>
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0">
<display-name>amigo</display-name> <!-- opensessioninviewfilter pattern --> <filter> <filter-name>sessionfilter</filter-name> <filter-class>org.springframework.orm.hibernate4.support.opensessioninviewfilter</filter-class> </filter> <filter-mapping> <filter-name>sessionfilter</filter-name> <url-pattern>/rest/*</url-pattern> </filter-mapping> <servlet> <servlet-name>jersey rest service</servlet-name> <servlet-class>org.glassfish.jersey.servlet.servletcontainer</servlet-class> <init-param> <param-name>javax.ws.rs.application</param-name> <param-value>br.com.mobcube.rest.amigoocultoapplication</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>jersey rest service</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
and applicationcontext:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" 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/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <!-- scan pacote para processar annotations --> <context:component-scan base-package="br.com.mobcube"> <context:include-filter type="annotation" expression="org.aspectj.lang.annotation.aspect" /> </context:component-scan> <!-- conexao.properties --> <bean class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="location" value="classpath:conexao.properties" /> </bean> <!-- sessionfactory hibernate --> <bean id="sessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean"> <property name="datasource" ref="datasource" /> <property name="configlocation" value="classpath:hibernate.cfg.xml" /> <property name="packagestoscan" value="br.com.mobcube.domain" /> <property name="hibernateproperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.format_sql">${hibernate.format_sql}</prop> <prop key="hibernate.use_sql_comments">${hibernate.use_sql_comments}</prop> </props> </property> <property name="namingstrategy"> <bean class="org.hibernate.cfg.improvednamingstrategy" /> </property> </bean> <!-- data source banco de dados --> <bean id="datasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="url" value="${jdbc.url}" /> <property name="driverclassname" value="${jdbc.driver_class}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <!-- hibernate = transaction manager --> <bean id="transactionmanager" class="org.springframework.orm.hibernate4.hibernatetransactionmanager"> <property name="sessionfactory" ref="sessionfactory" /> </bean> <!-- transacao com @transaction --> <tx:annotation-driven transaction-manager="transactionmanager" /> <!-- @autowire --> <context:annotation-config /> <!-- spring aop aspectj --> <aop:aspectj-autoproxy />
any tips?
what did recreate server , clean project: works fine now. should eclipse bug/issue.
Comments
Post a Comment