开发者社区> 问答> 正文

Maven构建SSH项目添加依赖支持报错 ?报错

我在使用Maven搭建SS2H项目的时候,使用了


org.springframework
spring-web
4.1.3.RELEASE

之后web.xml的

org.springframework.web.context.ContextLoaderListener

就会报错,是找不到,去掉了就可以但是在项目启动的时候就会报错,加了之后会有报错说Error:java: java.lang.ArrayIndexOutOfBoundsException: 60533

展开
收起
爱吃鱼的程序员 2020-06-22 23:56:40 425 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    又找了一天,终于发现问题了,我打开下载的spring-web包找对应的类去看,一看有相应的.class文件存在就以为是包是没问题的,但是刚才我把jar解压出来了,打开相应的.class文件一看,居然是空的,里面的内容都没有了,应该是在下载的时候除了一点问题,导致相应的文件没有下载下来,我把相应的包删掉了重新下载了一次之后发现问题解决了

    报错说Error:java:java.lang.ArrayIndexOutOfBoundsException:60533
    这里就是数组越界了,仔细检查下

    <dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-expression</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>4.1.3.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId><version>4.1.3.RELEASE</version></dependency><!--Struts2.x支持--><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-core</artifactId><version>2.3.24</version></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-json-plugin</artifactId><version>2.3.24</version></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-spring-plugin</artifactId><version>2.3.24</version></dependency><!--Hibernate支持--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.36</version></dependency><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>4.3.11.Final</version></dependency><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-c3p0</artifactId><version>4.2.13.Final</version></dependency><dependency><groupId>org.hibernate.javax.persistence</groupId><artifactId>hibernate-jpa-2.1-api</artifactId><version>1.0.0.Final</version></dependency><dependency><groupId>antlr</groupId><artifactId>antlr</artifactId><version>2.7.7</version></dependency><dependency><groupId>org.javassist</groupId><artifactId>javassist</artifactId><version>3.18.1-GA</version></dependency><dependency><groupId>org.jboss.spec.javax.transaction</groupId><artifactId>jboss-transaction-api_1.2_spec</artifactId><version>1.0.0.Final</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.12</version></dependency><dependency><groupId>com.mchange</groupId><artifactId>c3p0</artifactId><version>0.9.5</version></dependency><dependency><groupId>com.mchange</groupId><artifactId>mchange-commons-java</artifactId><version>0.2.10</version></dependency><!--Common包支持--><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.4</version></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.3.2</version></dependency><dependency><groupId>commons-dbcp</groupId><artifactId>commons-dbcp</artifactId><version>1.4</version></dependency><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.3.1</version></dependency><dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId><version>1.2</version></dependency><dependency><groupId>commons-pool</groupId><artifactId>commons-pool</artifactId><version>1.6</version></dependency><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency>
    <!--Spring的监听器可以通过这个上下文参数来获取beans.xml的位置--><context-param><param-name>contextConfigLocation</param-name><param-value>classpath*:applicationContext.xml</param-value></context-param><!--设置log4j配置文件路径--><context-param><param-name>log4jConfigLocation</param-name><param-value>WEB-INF/classes/log4j.properties</param-value></context-param><!--开一条watchdog线程每600秒扫描一下配置文件的变化--><context-param><param-name>log4jRefreshInterval</param-name><param-value>6000000</param-value></context-param><!--在该配置文件中myWebApp.root就是我们在第三步中配置的内容。名字可以自己更改。在第三步配置webAppRootKey还有一个作用就是避免在同一个web容器中(例如tomcat)有多个web项目而产生混乱--><context-param><param-name>webAppRootKey</param-name><param-value>BaseModel.root</param-value></context-param><!--创建Spring的监听器--><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><listener><listener-class>org.springframework.web.util.Log4jConfigListener</listener-class></listener><filter><filter-name>OpenSessionFilter</filter-name><filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class><!--指定在spring配置的sessionFactory--><init-param><param-name>sessionFactoryBeanName</param-name><param-value>sessionFactory</param-value></init-param><!--singleSession默认为true,若设为false则等于没用OpenSessionInView--><init-param><param-name>singleSession</param-name><param-value>true</param-value></init-param></filter><filter-mapping><filter-name>OpenSessionFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><filter><filter-name>encodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param></filter><filter-mapping><filter-name>encodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping>

    以上是我的pom.xml和web.xml文件,找不到会产生数组越界的地方呢

    2020-06-22 23:56:57
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载