使用Maven搭建项目时错误

                                                        不怕错误多,就怕不积累
1. 错误:读取 /home/subaochen/.m2/repository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar 时出错;invalid LOC header (bad signature)

    解决:原因由于maven的使用个别jar包摔坏,所以删除相关的jar包,然后等maven重新下载相关jar包即可
    
2.创建sessionFactory及测试
    public class SessionFactoryTest {
    @Test
    public void testSessionFactory(){
        ApplicationContext context = new ClassPathXmlApplicationContext("cn/itcast/gyl/spring/applicationContext.xml");
        SessionFactory sessionFactory = (SessionFactory)context.getBean("sessionFactory");
    }
}

3.找不到‘departmentDao’,或者找不到‘baseDao’
      org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'departmentDao' is defined
    原因:
        (1)未在spring中配置相关的<bean> 目录,如<bean id="helloWorld" class="com.itheima11.spring.ioc.helloworld.HelloWorld"></bean>
    结局办法:
        (1)添加相关的<bean></bean>
        (2)首先:在相应的public class DepartmentDaoImpl extends BaseDaoImpl<Department> implements DepartmentDao
    中注释    @Repository("departmentDao")
                  其次配置:<!--表明com.xwp.gyl包及其子包中,如果某个类的头上带有特定的注解
    @Component,@Repository,@Service,@Controller,就会将这个对象作为Bean注册进spring容器。
    -->
    <context:component-scan base-package="com.xwp.gyl"></context:component-scan>

4.使用maven部署项目出现Struts Problem Report
    一.可能是struts.xml配置错误
    二.可能是maven中的jar包错误,需要删除,然后重新部署下载相关jar包
    
5.hibernate中显示不能连接数据库
    一.配置出错
    二.由于系统原因,可能关闭了相关的服务项,及mysql/oracle服务项未启动,需要开启相关服务·
    
6.无法打开unknown(此处耽误3小时)
    Stacktraces
        org.springframework.orm.hibernate3.HibernateQueryException: Privilege is not mapped [from Privilege];
    nested exception is org.hibernate.hql.ast.QuerySyntaxException: Privilege is not mapped [from Privilege]

    Struts Problem Report
    Struts has detected an unhandled exception:
    Messages:     
        User is not mapped [select count(*) from User where 1 = 1 ]
        User is not mapped [select count(*) from User where 1 = 1 ]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select count(*) from User where 1 = 1 ]
    错误原因:1.实体写错
             2.hbm.xml写错
            
7.严重: StandardServer.await: create[8005]:
        Java.NET.BindException: Address already in use: JVM_Bind
        原因分析:
            从上面的描述中就可以看到,是因为端口8005被占用了。
        解决方法:
            在cmd中输入命令:netstat -ano,查看所有端口的占用情况,找到占用端口8005的进程pid,然后在任务管理器
        中删除该进程,再启动tomcat就可以了。
        
        通常出现Address already in use: JVM_Bind错误的可能性分析
            I.就是当前端口已经有别的程序在占用着,所以要么把占用这个端口的程序关闭,要么重新换一个端口
            II.端口号被占用,如果你有装oracle的话,有可能是oracle使用了8080端口,oracle安装后并且如果
            启动了OracleHttp服务会占用8080端口
            III.我认为很可能是多启动了几次TOMCAT,在ECLIPSE下重复启动TOMCAT就会出现这个问题,你去调查
            一下看看是否是这个原因.
            IV.如果不是windows操作系统,那么80端口已经被占用.如果是windows操作系统.请检查是否装有IIS.
            V.启动了多个Tomcat。
            我就是因为启动了两个Tomcat,所以才会报这样的错误,通常情况下, 多次启动Tomcat或者非正常关
            闭Myeclipse,但是占用端口的进程没有关闭,也会出现这样的错误。解决方法是关闭javaw.exe进程。

8.maven项目下启动tomocat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener    
        困扰时间:1天
        困扰原因:以为是maven下面的jar包出错,使用在重新下载资源库的jar包,结局还是出错
        原因分析及解决:
                如果你是maven项目,tomcat在发布项目的时候没有同时发布maven依赖所添加的jar包,
        你需要设置一下eclipse:
        项目 —> 属性 -> Deployment Assembly -> Add -> Java Build Path Entries -> 选择Maven Dependencies -> Finish -> OK
        把对应的Maven依赖包也发布到tomcat,调试时会自动把那些jar发布到指定目录下,tomcat也能找到那些jar了。    

9.    Illegal access: this web application instance has been stopped already.  Could not load java.net.BindException.  The
eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate
the thread which cau    
    jdbc配置出错:配置·相应的数据账号    
    
10.
解决org.springframework.beans.factory.BeanCreationException: Error creating bean with name  

解决方法:

用rar打开 hibernate3.jar,里面已经包含annotations相关包,与老版本冲突。
解决的方法:将lib目录下的: hibernate-annotations.jar 和 hibernate-commons-annotations.jar 删除后重新部署可。                    

11. 【错误】
打开eclipse报错:发现了以元素 ‘d:skin’ 开头的无效内容。此处不应含有子元素。

【具体报错信息】
Error parsing D:\Android-sdks\system-images\android-22\android-wear\armeabi-v7a\devices.xml cvc-complex-type.2.4.d:
 发现了以元素 ‘d:skin’ 开头的无效内容。此处不应含有子元素。 Error: Error parsing D:\android-sdks\system-images\android-22\
 android-wear\x86\devices.xml cvc-complex-type.2.4.d: 发现了以元素 ‘d:skin’ 开头的无效内容。此处不应含有子元素。

【解决方法】 修改所有报错文件
方法1: 在SDK Manager里删除Android-wear相关的image 方法2: 进入sdk目录下,把..\android-sdk\system-images\android-22\
android-wear\armeabi-v7a\devices.xml和..\android-sdk\system-images\android-22\android-wear\x86\devices.xml文件删除,
再把sdk里面..\android-sdk\tools\lib\下的devices.xml拷贝到上述两个文件夹里,重启eclipse即可

                                    
        http://localhost:8080/gylxt/roleAction_showRoles.action
        http://localhost:8080/gylxt/menuitemAction_showMenuitemTree.action
        http://localhost:8080/gylxt/privilegeAction_showPrivilegeTree.action
        http://localhost:8080/gylxt/forwardAction_forward.action?method=role
        http://localhost:8080/gylxt/departmentAction_showPageResult.action
        http://localhost:8080/gylxt/userAction_showPageResult.action
        http://localhost:8080/gylxt/rolePrivilege_showRoles.action
        http://localhost:8080/gylxt/userRole_showUserList.action

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值