블로그 이미지

uchacha

개발자 일지

,

- @참고 : https://stackoverflow.com/questions/22914927/creating-a-src-main-java-folder-structure-in-eclipse-without-maven

 

Creating a src/main/java folder structure in Eclipse without Maven

How do I create the src/main/java and src/test/java in my default web application project in Eclipse without Maven? My current folder structure is TestApp ├── JavaResources │ └── src │ ...

stackoverflow.com

원인

소스 폴더 안에 또다른 소스 폴더안에 갖을 수 없으므로 src/main/java를 생성하기 전에 src를 소스 폴더로 취급하지 않도록 Eclipse에 지시해야 합니다.

 

해결

이를 수행하려면 src 폴더를 마우스 오른쪽 클릭 후 '빌드 경로' → '빌드 경로에서 제거'를 선택하면 된다.

이 src는 폴더 트리에 정상적인 위치에 표시되므로 그 아래에 기본 및 java 폴더를 작성하고 src/main/java폴더 구조를 만든 후에

마지막으로 새로 작성된 java 폴더를 마우스 오른쪽 단추로 클릭하고 빌드 경로 → '소스 폴더로 사용'을 선택하십시오.

 

추가

이 후 Maven update 시

Cannot nest 'Foldername/src/main/java' inside 'Foldername/src'. To enable the nesting exclude 'main/' from..

과 같은 에러가 난다면

pom.xml에 가서 sourceDirectory가 src/main/java로 잡혀있는지 확인하고 그렇지 않을 시 변경해줍니다.

블로그 이미지

uchacha

개발자 일지

,

- @참고 : https://cornswrold.tistory.com/232

에러 내역

to prepare test instance [INSTANCE_ADDRESS] java.lang.NoClassDefFoundError: javax/servlet/SessionCookieConfig at org.springframework.test.context.web.AbstractGenericWebContextLoader.configureWebResources(AbstractGenericWebContextLoader.java:188) at org.springframework.test.context.web.AbstractGenericWebContextLoader.loadContext(AbstractGenericWebContextLoader.java:124) at org.springframework.test.context.web.AbstractGenericWebContextLoader.loadContext(AbstractGenericWebContextLoader.java:61) at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:281) at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:249) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:189) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:131) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) Caused by: java.lang.ClassNotFoundException: javax.servlet.SessionCookieConfig at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 32 common frames omitted

 

원인 및 해결 방안

Spring 4.0 이상 버전을 사용할 때 spring-test 를 이용하여 Test를 진행하면 생기는 에러이다.

해당 에러는 Servlet 버전을 3.0.1 이상으로 맞춰주면 해결된다.

 

Java 버전 체크 정보

spring framework - @참고 : https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Versions

apache tomcat - @참고 : http://tomcat.apache.org/whichversion.html

블로그 이미지

uchacha

개발자 일지

,

- @참고 : https://lng1982.tistory.com/199

java version을 1.6에서 1.8로 업데이트 하여 project facet을 바꿔놓은 프로젝트를 다시 원복하려는데 위의 제목과 같은 에러가 나서 원복할 수가 없었다.

해당 에러의 체크 포인트는

1. workspace의 .settings디렉토리의 org.eclipse.wst.common.project.facet.core.xml파일

2. web.xml의 XML 스키마 설정

부분인 듯 하다.

나의 경우는 1번을 수정해주자 project facet 설정이 가능했다.

블로그 이미지

uchacha

개발자 일지

,

- @참고 : https://stackoverflow.com/questions/10758555/java-lang-nosuchmethoderror-javax-servlet-http-httpservletrequest-startasync

- @참고2 : https://www.jetbrains.com/help/idea/work-with-maven-dependencies.html

 

에러 내역

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getAsyncContext()Ljavax/servlet/AsyncContext; at org.springframework.test.web.servlet.TestDispatcherServlet.service(TestDispatcherServlet.java:73) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.springframework.mock.web.MockFilterChain$ServletFilterProxy.doFilter(MockFilterChain.java:160) at org.springframework.mock.web.MockFilterChain.doFilter(MockFilterChain.java:127) at org.springframework.test.web.servlet.MockMvc.perform(MockMvc.java:151) at com.wizvera.pinsign.admin.web.controller.LoginControllerTest.loginTest(LoginControllerTest.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)

 

해결방법

servlet version이 3.0 이상이어야 javax.servlet.http.HttpServletRequest.getAsyncContext() 해당 메소드가 존재하는데 servlet 버전이 낮아 해당 메소드가 존재하지 않아서 나는 에러이다. 내 경우에는 pom.xml에서 servlet version을 3.1로 맞추었지만 cors-filter에서 transitively하게 v2.5를 가져와서 해당 에러가 났다. 따라서 전이적으로 낮은 servlet 버전을 가져온 cors-filter의 버전을 1.3.2에서 2.5로 올려줬더니 getAsyncContext()를 찾는다.

또는

exclusion을 통해 버전을 잘못가져온 해당 라이브러리를 제외해주니 해결된다.

<dependency>
  <groupId>com.thetransactioncompany</groupId>
  <artifactId>cors-filter</artifactId>
  <version>1.3.2</version>
  <exclusions>
    <exclusion>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
    </exclusion>
  </exclusions>
</dependency>
블로그 이미지

uchacha

개발자 일지

,

- @참고: http://blog.naver.com/PostView.nhn?blogId=eple_freeweb&logNo=221622249244&parentCategoryNo=50&categoryNo=&viewDate=&isShowPopularPosts=false&from=postView

 

[이클립스] local jar 지우고 unable to load annotation processor factory error 뜰 때

프로젝트에서 maven을 이용하지 않고 프로젝트 동작의 편리성을 위해 만드는 jar 가 있다. 별도로 넥서스를...

blog.naver.com

프로젝트에서 maven을 이용하지 않고 프로젝트의 동작의 편리성을 위해 만드는 jar가 있다.

별도로 넥서스를 사용하기도 하지만 오래된 프로젝트는 내부에 파일로 들어있다.

위의 제목(Unable to load annotation processor factory 'jar' for project)과 같은 에러가 났을 때

프로젝트 우클릭 > properties

Java compiler > Annotation Processing > Factory Path

가보면 리스트에 체크박스가 되어있을 것이다.

해당 라이브러리의 체크박스를 해제하던가

Enable project specific settings 체크를 해제해준다.

블로그 이미지

uchacha

개발자 일지

,

1. ctrl + alt + c로 postman 콘솔창을 연다.

2. 메세지가 다음과 같았다.

postman Error: error:0906D06C:PEM routines:PEM_read_bio:no start line

→ 인증서 값이 제대로 되지 않아 읽어올 때 실패하는 것 같다.

3. settings > Certificates > client certificates가 등록되어 있어서 삭제

했더니 잘 동작했다.

블로그 이미지

uchacha

개발자 일지

,

방법1.

@ 참고 : 내 경험

#1. 삭제 후 재 설치


방법2. 이 방법은 실행했으나 안 먹힘

@ 참고 : https://moomini.tistory.com/65

 

이클립스(Eclipse) 실행시 아무 반응이 없는 오류 해결

(공감과 댓글 하나는 글쓴이에게 큰 힘이 됩니다.) eclipse.exe 파일을 실행하면 이클립스(Eclipse)가 실행이 되지않고, 아무 반응이 없는 경우가 종종 있다. 이 경우 응용 프로그램을 실행할 때 초기화 정보를 담..

moomini.tistory.com

#1. eclipse 폴더(C:\eclipse-jee-2018-09-win32\eclipse) 내 eclipse.ini 파일 열기

#2. jdk 경로 -bin 폴더의 javaw.exe 파일이 있는 경로 복사하기

#3. eclipse.ini 파일의 openFile 항목 밑에  --vm을 입력한 후 복사한 경로를 붙여넣고, 끝에 \javaw.exe를 붙여넣기

openFile 

--launcher.appendVmargs 

--vm 

C:\Program Files\Java\jdk1.8.0_211\bin\javaw.exe

 

블로그 이미지

uchacha

개발자 일지

,