maven搭建完项目后,在myeclipse里面布置到TOMCAT,启动项目会报一个错误,但是我如果把pom.xml里面去除一个引用包,在保存,然后在把这个引用包加上(相当于POM.XML完全没变),在保存,在重新启动项目,就没错了,项目访问也一切正常,这样操作好像只是能够重新build一下工作空间吧,其他的不清楚了。
导致我每次用myeclipse把工程放到tomcat下面,都得重新编辑下pom文件,当然只有第一次把工程放到tomcat需要这样,工程一直发布着,我在myeclipse里面修改、访问、redeploy什么的就都没问题了。
错误日志:
2012-09-22 15:28:47,766 INFO org.hibernate.impl.SessionFactoryImpl - closing
2012-09-22 15:28:47,795 ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseHibernateDAO' defined in file [D:\work\apache-tomcat-7.0.23\webapps\sshmodel\WEB-INF\classes\common\base\dao\hibernate\BaseHibernateDAO.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [common.base.dao.hibernate.BaseHibernateDAO]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems:
The import org.hibernate.impl cannot be resolved
The import org.hibernate.impl cannot be resolved
The import org.springframework.orm cannot be resolved
HibernateDaoSupport cannot be resolved to a type
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
The method getSession() is undefined for the type BaseHibernateDAO
The method getSessionFactory() is undefined for the type BaseHibernateDAO
The method getSession() is undefined for the type BaseHibernateDAO
CriteriaImpl cannot be resolved to a type
CriteriaImpl cannot be resolved to a type
CriteriaImpl cannot be resolved to a type
CriteriaImpl cannot be resolved to a type
Subcriteria cannot be resolved to a type
CriteriaImpl cannot be resolved to a type
CriteriaImpl cannot be resolved to a type
The method getSession() is undefined for the type BaseHibernateDAO
CriteriaImpl cannot be resolved to a type
CriteriaImpl cannot be resolved to a type
CriteriaImpl cannot be resolved to a type
The method getHibernateTemplate() is undefined for the type BaseHibernateDAO
CriteriaImpl cannot be resolved to a type
CriteriaImpl cannot be resolved to a type
The method getSessionFactory() is undefined for the type BaseHibernateDAO
The method getSessionFactory() is undefined for the type BaseHibernateDAO
The method getSessionFactory() is undefined for the type BaseHibernateDAO
The method getSessionFactory() is undefined for the type BaseHibernateDAO
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) ~[spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) ~[spring-context-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) ~[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) ~[spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765) [catalina.jar:7.0.23]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260) [catalina.jar:7.0.23]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.23]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866) [catalina.jar:7.0.23]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842) [catalina.jar:7.0.23]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615) [catalina.jar:7.0.23]
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095) [catalina.jar:7.0.23]
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617) [catalina.jar:7.0.23]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_13]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_13]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_13]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_13]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_13]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_13]
另外,我反编译了生成的错误的类:BaseHibernateDAO,里面方法都成了:
public <T> void update(Object paramObject)
{
throw new Error("Unresolved compilation problem: \n\tThe method getHibernateTemplate() is undefined for the type BaseHibernateDAO\n");
}
这样了。
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>com.lb</groupId>
<artifactId>sshmodel</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>sshmodel Maven Webapp</name>
<url>http://maven.apache.org</url>
<distributionManagement>
<repository>
<id>repo</id>
<name>public</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>Snapshots</id>
<name>Snapshots</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Shared version number properties -->
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
<org.struts.version>2.2.1</org.struts.version>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${org.springframework.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Spring配置结束 -->
<dependency>
<groupId>org.logicalcobwebs.proxool</groupId>
<artifactId>proxool</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.logicalcobwebs.proxool</groupId>
<artifactId>proxool-cglib</artifactId>
<version>0.9.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>${org.struts.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.3.2.GA</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-commons-annotations</artifactId>
<version>3.1.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>3.3.1.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>org.apache.struts.xwork</groupId>
<artifactId>xwork-core</artifactId>
<version>${org.struts.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${org.struts.version}</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>${org.struts.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>${org.struts.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>org.htmlparser</groupId>
<artifactId>htmlparser</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>jxl</groupId>
<artifactId>jxl</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.21</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>ognl</groupId>
<artifactId>ognl</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.19</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>java</id>
<name>java official repository</name>
<url>http://download.java.net/maven/2/</url>
</repository>
</repositories>
<build>
<finalName>sshmodel</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
问题补充:刚有看了下,和baseHibernateDAO 没关系,简单来说,我这个项目第一次发布就不成功,需要修改下POM(随便删个包,保存,在加上,保存),修改POM可能是会把class都有重新编译一遍吧?这样才会成功,当然修改POM是在MYECLIPSE部署到TONCAT后修改,修改后进度条显示builw workspace,是不是吧重新编译的类放进tomcat里面了?
问题补充:没装m2eclipse,myeclipse10自带,关键是hudson自动任务是不会报错的,但生成的war文件放到tomcat底下还会报这个错误,看样子像是有些类编译的不对,但重新编译一遍就行了。
相关推荐
"Maven搭建SSH项目"是一个基础的Java Web开发模板,通过Maven管理项目构建,结合Struts2处理请求,Spring管理依赖和事务,Hibernate进行数据操作。这样的组合可以快速构建出功能完备的应用,并易于维护和扩展。理解...
总结,Maven搭建SSH工程涉及到多个步骤,包括Maven的安装与配置、SSH框架的依赖引入、配置文件的创建和编辑、业务逻辑的编写以及最后的测试与部署。理解并熟练掌握这些步骤,对于Java Web开发者来说是非常重要的技能...
** Maven的简单使用以及Maven搭建SSH ** Maven是一个强大的Java项目管理工具,它能够帮助开发者构建、管理和部署项目。Maven通过使用一个统一的项目对象模型(Project Object Model,POM)来描述项目,并利用插件...
在IT行业中,SSH(Spring、Struts、Hibernate)是一个经典的Java Web开发框架组合,而Maven则是一个项目管理和综合工具,常用于构建和管理Java项目。本篇文章将深入探讨如何利用Maven搭建SSH框架,以及在这个过程中...
Maven搭建SSH框架Demo,Maven是可以解决包依赖问题,在搭建SSH(struts2,spring3,hibernate)框架时不用考虑包的依赖问题,提高了开发效率,该demo已经完成框架的搭建,可以直接拿来使用
通过上述步骤,你就可以在Maven下成功地搭建一个基于注解的SSH项目框架。这个框架的配置文件已包含了详细的注释,方便初学者理解。下载提供的webFrame文件,你可以直接参考其中的代码和配置,进行学习和实践。
通过上述步骤,我们可以搭建起一个基本的SSH框架,结合Maven的强大功能,使项目管理变得更加有序和高效。对于初学者,这是一个很好的学习实践,有助于理解Java Web开发的全貌和SSH框架的运作机制。提供的链接博客...
在搭建SSH框架时,首先,我们需要在Eclipse中创建一个Maven项目,配置pom.xml文件引入SSH框架和其他必要的依赖。然后,按照MVC设计模式划分项目结构,包括模型(Model)、视图(View)和控制器(Controller)三层。...
"构建基于Maven的SSH原型项目"这个主题,旨在帮助初学者理解和掌握如何使用这些技术搭建一个基础的Web应用。 首先,Maven是Apache开发的一个项目管理工具,它通过一个项目对象模型(Project Object Model,POM)来...
在IT行业中,SSH(Struts2、Spring、Hibernate)是一个非常经典的Java Web开发框架组合,它结合了MVC模式的Struts2、依赖注入的Spring以及对象关系映射的Hibernate,为开发者提供了一套高效、稳定的开发环境。...
在这个基于Maven的SSH框架搭建实例中,我们将探讨如何利用这些框架以及Maven构建工具来搭建一个完整的Web项目。 首先,Spring框架是核心,它提供了依赖注入(DI)和面向切面编程(AOP)的功能,以实现松耦合和更好...
现在我们将深入探讨如何使用Maven来搭建一个基于SSH框架的项目。 首先,创建一个新的Maven项目。在IDE如IntelliJ IDEA或Eclipse中,选择“New -> Maven Project”,填写项目的基本信息,包括GroupId(通常代表公司...
Maven整合SSH案例 ************************************************************************************* 注意:运行前请配置Maven环境,和修改config.properties中数据库名称用户和密码,并且修改Tuser中的...
在本教程中,我们将深入探讨如何利用Maven构建一个基于SSH的Web应用程序。 首先,Struts2作为MVC(Model-View-Controller)架构的一部分,负责处理HTTP请求并管理视图与控制器之间的交互。它的核心是Action类,它...
SSH+maven搭建的项目
在IT行业中,SSH框架指的是Struts、Spring和Hibernate这三个开源框架的组合,它们分别是MVC模式下的动作层、业务层和服务层的代表。Maven是一个强大的项目管理工具,用于构建、管理和依赖管理。Ehcache则是一个广泛...
Maven搭建ssh框架pom.xml文件,直接复制到项目下即可使用。
【标题】"Maven 整合SSH之一" 涉及到的是在Java开发中如何使用Maven构建工具来整合Spring、Struts2和Hibernate这三个流行框架,这通常被称为SSH集成。SSH是一套强大的Java Web应用程序开发解决方案,可以帮助开发者...
在IT行业中,SSH(Spring、Struts和Hibernate)是一个经典的Java Web开发框架组合,而Maven则是一个项目管理和综合工具,用于自动化构建、项目信息管理以及依赖管理。本实例主要探讨如何利用Maven来构建一个整合了...