java - NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession() -
hello
i'm getting strange error:
java.lang.nosuchmethoderror: org.hibernate.sessionfactory.getcurrentsession()lor g/hibernate/classic/session; @ org.cometd.hibernate.util.hibernateutil.getsessionfactory(hibernateut il.java:29) @ org.cometd.hibernate.util.hibernateutil.getsession(hibernateutil.java :54)
but method exists in sessionfactory class in javadocs!
eclipse shows me in autocomplete.
other methods, i.e. opensession() or closesession() work correct.
problem can hide?
pom.xml:
<?xml version="1.0" encoding="utf-8"?> <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"> <build> <defaultgoal>install</defaultgoal> <plugins> <plugin> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <artifactid>maven-war-plugin</artifactid> <configuration> <overlays> <overlay /> <overlay> <groupid>org.cometd.javascript</groupid> <artifactid>cometd-javascript-dojo</artifactid> </overlay> </overlays> </configuration> </plugin> <plugin> <groupid>org.mortbay.jetty</groupid> <artifactid>maven-jetty-plugin</artifactid> <version>6.1.24</version> <configuration> <scanintervalseconds>10</scanintervalseconds> <webappconfig> <contextpath>/sample</contextpath> </webappconfig> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.cometd.java</groupid> <artifactid>cometd-api</artifactid> <version>1.1.2</version> </dependency> <dependency> <groupid>org.cometd.javascript</groupid> <artifactid>cometd-javascript-dojo</artifactid> <version>1.1.2</version> <type>war</type> </dependency> <dependency> <groupid>org.cometd.java</groupid> <artifactid>cometd-java-server</artifactid> <version>1.1.2</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>3.3.2.ga</version> <!--<version>3.6.0.final</version>--> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-annotations</artifactid> <version>3.4.0.ga</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> <version>3.1.0.ga</version> </dependency> <!-- log4j --> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.5.10</version> <!-- <scope>runtime</scope> --> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.5.10</version> <!-- <scope>runtime</scope> --> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.5.10</version> </dependency> <dependency> <groupid>log4j</groupid> <artifactid>log4j</artifactid> <version>1.2.15</version> <exclusions> <exclusion> <groupid>javax.mail</groupid> <artifactid>mail</artifactid> </exclusion> <exclusion> <groupid>javax.jms</groupid> <artifactid>jms</artifactid> </exclusion> <exclusion> <groupid>com.sun.jdmk</groupid> <artifactid>jmxtools</artifactid> </exclusion> <exclusion> <groupid>com.sun.jmx</groupid> <artifactid>jmxri</artifactid> </exclusion> </exclusions> <!-- <scope>runtime</scope> --> </dependency> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.9</version> </dependency> <dependency> <groupid>org.jmock</groupid> <artifactid>jmock-junit4</artifactid> <version>2.5.1</version> </dependency> <dependency> <groupid>org.quartz-scheduler</groupid> <artifactid>quartz</artifactid> <version>1.8.2</version> </dependency> <!-- hibernate framework --> <dependency> <groupid>hibernate</groupid> <artifactid>hibernate3</artifactid> <version>3.2.3.ga</version> </dependency> <!-- hibernate annotation --> <dependency> <groupid>hibernate-annotations</groupid> <artifactid>hibernate-annotations</artifactid> <version>3.3.0.ga</version> </dependency> <dependency> <groupid>hibernate-commons-annotations</groupid> <artifactid>hibernate-commons-annotations</artifactid> <version>3.0.0.ga</version> </dependency> <!-- hibernate library dependecy start --> <dependency> <groupid>dom4j</groupid> <artifactid>dom4j</artifactid> <version>1.6.1</version> </dependency> <dependency> <groupid>commons-collections</groupid> <artifactid>commons-collections</artifactid> <version>3.2.1</version> </dependency> <dependency> <groupid>antlr</groupid> <artifactid>antlr</artifactid> <version>2.7.7</version> </dependency> <dependency> <groupid>javassist</groupid> <artifactid>javassist</artifactid> <version>3.5.0.ga</version> </dependency> </dependencies> <repositories> <repository> <id>jboss repository</id> <url>http://repository.jboss.com/maven2/</url> </repository> </repositories> </project>
p.s. code is
org.hibernate.sessionfactory sessionfactory = new configuration().configure().buildsessionfactory(); org.hibernate.session session = sessionfactory.getcurrentsession();
i think might down multiple hibernate version on classpath. looks many here...
<dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>3.3.2.ga</version> <!--<version>3.6.0.final</version>--> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-annotations</artifactid> <version>3.4.0.ga</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> <version>3.1.0.ga</version> </dependency> .... <dependency> <groupid>hibernate</groupid> <artifactid>hibernate3</artifactid> <version>3.2.3.ga</version> </dependency> <!-- hibernate annotation --> <dependency> <groupid>hibernate-annotations</groupid> <artifactid>hibernate-annotations</artifactid> <version>3.3.0.ga</version> </dependency> <dependency> <groupid>hibernate-commons-annotations</groupid> <artifactid>hibernate-commons-annotations</artifactid> <version>3.0.0.ga</version> </dependency>
Comments
Post a Comment