Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10


알고리즘을 풀던중 라는 오류가 발생했습니다.


ArrayIndexOutOfBoundsException을 알아보도록 하겠습니다!!


우선 의미는

" 잘못된 인덱스를 사용해서 배열에 접근했다는 것을 알려주기 위한 예외입니다. 인덱스는 0보다 크거나 배열의 사이즈보다 작아야 합니다. "


라는 의미입니다.


저 같은 경우, for문을 통한 완전탐색을 하다가 마지막 인덱스에 크기를 잘못 고려하여 발생하였습니다.

(인덱스가 0~9 까지인데 10번째 인덱스 접근했습니다...ㅎㅎ)






* issue

SVN ....[get content / revert] failed....

  => 파일이 lock이 걸린것!!


goal)) clean up으로 lock을 풀어줘야한다.




* solution


1. lock을 풀기위해 sqlitebrowser라는 프로그램을 사용합니다.

 cf> https://sqlitebrowser.org/



2. 새 데이터베이스에 workspace > .svn > wc.db 를 추가합니다.

 ex> C:\[프로젝트 폴더]\workspace\webapps\l[프로젝트명]\.svn


3. select문으로 lock의 여부를 확인후 delete 문으로 실행!


cf> WORK_QUEUE와 WC_LOCK이 delete 되어야 한다. 

# select

*

from WORK_QUEUE;


--delete from WORK_QUEUE;


# select

*

from WC_LOCK;


--delete from WC_LOCK;

4. 우리의 목표였던 svn에서의 clean up을 실행한다.


Maven - 이클립스 Maven 연동 시 plug in 에러 날 경우


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Multiple annotations found at this line:
- Execution default-testResources of goal org.apache.maven.plugins:maven-resources- plugin:2.4.3:testResources failed: 
Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to collect 
dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 () (org.apache.maven.plugins:maven-resources-
plugin:2.4.3:testResources:default-testResources:process-test-resources)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile 
(execution: default-compile, phase: compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: 
PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be 
resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 (): 
ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6
ArtifactResolutionException: Failure to transfer org.apache.maven:maven-plugin-api:pom:2.0.6 from http://repo1.maven.org/
maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or 
updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (http://
repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-
api-2.0.6.pom
- CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: 
PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be 
resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 (): 
ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6
ArtifactResolutionException: Failure to transfer org.apache.maven:maven-plugin-api:pom:2.0.6 from http://repo1.maven.org/
maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or 
updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (http://
repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-
api-2.0.6.pom
- Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources failed: Plugin 
org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to collect 
dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 () (org.apache.maven.plugins:maven-resources-
plugin:2.4.3:resources:default-resources:process-resources)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:
2.3.2:testCompile (execution: default-testCompile, phase: test-compile)
cs

대략 이런 에러가 발생했을 경우.

POM.xml을 확인해보면 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<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.lala.sarasa</groupId>
    <artifactId>msrdecision</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>msrdecision Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>hello</finalName>
    </build>
</project>
cs


이렇게 되어 있을 것이고,
해결방법은 POM.xml에

1
2
3
4
5
<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.4.3</version>
</dependency>
cs

이런식으로 디펜던시를 추가해주면 된다.(현재 날짜 기준으로 최신버전인 3.2.1은 되지 
않는다.)


이렇게 작성해준 뒤에, 
1. 프로젝트 우클릭 > Run As > Maven Install
2. 이클립스 프로젝트 탐색기에서 해당 프로젝트 클릭 후 F5(새로고침)
3. 프로젝트 우클릭 > Maven > Update Project 


[1 단계] Servers tab에 server.xml source보기 클릭.



[2 단계] path 부분 중복되지 않게 수정해주기.


docBase : Eclipse상의 프로젝트 이름
path : 해당 프로젝트가 웹 상에 노출될 경로




+ Recent posts