2023년 6월 9일 금요일

Eclipse 프로젝트에서 java.lang.NoClassDefFoundError 대처

Eclipse에서  자바 클래스 파일을 jar파일을 통해 추가 했을 때

소스 상에서는 클래스 파일을 찾지만 서버에 배포했을 때 못찾는 경우 

프로젝트 옵션에서 Web Deplyment Assembly에 라이브러리 위치나 jar파일을 직접 추가하자

 




이후 Clean 작업 후 재 빌드를 하면 된다.

2023년 4월 17일 월요일

gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

  npm install 중 node-gyp 에서 다음과 같은 에러로 install이 안될 때


npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@3.8.0 npm ERR! gyp info using node@16.15.1 | win32 | x64 npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Command failed: \Python\Python310\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; npm ERR! gyp ERR! stack File "<string>", line 1 npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; npm ERR! gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? npm ERR! gyp ERR! stack npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:398:12) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:527:28) npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1092:16) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) npm ERR! gyp ERR! System Windows_NT 10.0.22621 npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" ".\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd .\node_modules\cap npm ERR! gyp ERR! node -v v16.15.1 npm ERR! gyp ERR! node-gyp -v v3.8.0


다음의 명령어로 install 실행

npm install --python=python2.7 cap

cap 만 python 2.7버전으로 빌드한다.

2022년 9월 22일 목요일

Geoserver SLD 동적 env 적용(PropertyName)

https://docs.geoserver.org/latest/en/user/styling/sld/extensions/substitution.html

참조 


SLD 스타일의 컬럼명을 지정할 때 

같은 스타일을 여러 레이어에서 활용하여 라벨링할 경우 레이어마다 컬럼명이 다를 수 있다.        

<se:Label>

    <ogc:PropertyName>spo_1km</ogc:PropertyName>

 </se:Label>

PropertyName이 동적으로 들어가야할 경우인데,

공식문서에 동적 SLD env 방법이 이렇게 적혀있어서 

<ogc:Function name="env">
   <ogc:Literal>size</ogc:Literal>
   <ogc:Literal>6</ogc:Literal>
</ogc:Function>

<ogc:PropertyName>안에 env를 넣으려고 한참 헤맸다.

다음과 같이 지정하면 된다.

colNm이 레이어에서 표현하고 싶은 컬럼명

            <se:Label>

              <ogc:Function name="property">

                <ogc:Function name="env">

                  <ogc:Literal>colNm</ogc:Literal>

                  <ogc:Literal>yr1995</ogc:Literal>

                </ogc:Function>

              </ogc:Function>

            </se:Label>

  

이후 코드에서 WMS 요청시  레이어에 맞게 env에 컬럼 명을 넣으면 동적으로 컬럼명을 입력한다.

 L.WMS.overlay(
                            GEOSERVER_URL + 'wms?',
                            {
                                service: 'WMS',
                                version: '1.1.0',
                                layers: 'seoulpolicy:' + POP_LAYER,
                                format: 'image/png',
                                transparent: true,
                                style: 'seoulpolicy:layerLabel',
                                env: 'colNm:spo_1km'
}
);





2022년 8월 10일 수요일

[PostGIS] 교차하는 피쳐들로 새로운 테이블 생성(ST_Intersect)

원래 데이터의 행 개수가 클 경우 QGIS 등에서 해당 파일을 열 수가 없다.

원 데이터의 특정 지역만 Intersect 하고 싶을 경우  PostGIS를 통해 미리 테이블 자체에서 미리 특정 지역만 잘라서 새로운 테이블을 만들고 해당 테이블을 활용하면 된다.


전국 50m격자 중 서울 지역만 뜯어내고 싶은데 10GB가 넘어 QGIS에서 열기도 어렵다.

서울 지역 shp를 활용하여 해당지역만 뜯어낸 새로운 테이블(shp)을 만들자 


CREATE TABLE new_table

AS

SELECT 

            tl_sppn_grid_50m.gid, tl_sppn_grid_50m.geom

FROM 

            tl_sppn_grid_50m,  pol.tbl_pol_grid_1km

WHERE 

    ST_Intersects(

    ST_Transform(

    ST_SetSRID(

    tl_sppn_grid_50m.geom, 5179

    ),

    3857

                ),

        pol.tbl_pol_grid_1km.geom

    );


ST_Transform으로 기존 좌표계와 Intersect할 좌표계를 맞춰주고, ST_Intersect를 통해 특정 지역만 자른 row들로 새로운 테이블을 만든다.

   





전국 50m 격자를 서울 1km 격자 범위만 Intersect하여 생성한 신규 서울 50m격자 테이블 






2022년 6월 3일 금요일

[Android] cordova-android 10 이상 적용시 Command로 Release 버전 Build할 시 aab로만 생성되는 경우

참조

 https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html

  • Android App Bundles aab Support

    By default, release builds will now generate an aab formatted package type for release.

    By nature, aab packages can not be deployed or pushed manually to a device for testing. If you need to test a release build, you will need to change the package type back to apk with the packageType flag.

    Debug builds will continue to create an apk formatted package.


cordova-android 10버전 이상부터 ionic cordova build android --release 생성시 apk로 생성되지 않고 aab로만 생성됨 - debug 버전은 apk로 생성
release apk 생성을 위해 packageType flag를 변경하라고 하는데,,,,
그냥 Android Studio의 Generate Signed Bundle or APK를 통해 생성하는게 빠름..



2022년 5월 31일 화요일

[Android] cordova-android 10.1.x 이상 버전 적용 이후 android 빌드 실행시 Whitelist와 FileTransfer의 의존성 문제

cordova-android 10.1.x 이상 버전 적용 이후 android 빌드 실행시

Whitelist와 FileTransfer의 의존성 문제


  location: class org.apache.cordova.whitelist.WhitelistPlugin

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\filetransfer\FileTransfer.java:691: error: cannot find symbol

                Whitelist whitelist = (Whitelist)gwl.invoke(webView);

                ^

  symbol:   class Whitelist

  location: class org.apache.cordova.filetransfer.FileTransfer

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\filetransfer\FileTransfer.java:691: error: cannot find symbol

                Whitelist whitelist = (Whitelist)gwl.invoke(webView);

                                       ^

  symbol:   class Whitelist

  location: class org.apache.cordova.filetransfer.FileTransfer

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:41: error: cannot find symbol

        this(new Whitelist(), new Whitelist(), null);

                 ^

  symbol:   class Whitelist

  location: class org.apache.cordova.whitelist.WhitelistPlugin

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:41: error: cannot find symbol

        this(new Whitelist(), new Whitelist(), null);

                                  ^

  symbol:   class Whitelist

  location: class org.apache.cordova.whitelist.WhitelistPlugin

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:45: error: cannot find symbol

        this(new Whitelist(), new Whitelist(), null);

                 ^

  symbol:   class Whitelist

  location: class org.apache.cordova.whitelist.WhitelistPlugin

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:45: error: cannot find symbol

        this(new Whitelist(), new Whitelist(), null);

                                  ^

  symbol:   class Whitelist

  location: class org.apache.cordova.whitelist.WhitelistPlugin

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:50: error: cannot find symbol

            allowedRequests = new Whitelist();

                                  ^

  symbol:   class Whitelist

  location: class org.apache.cordova.whitelist.WhitelistPlugin

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:61: error: cannot find symbol

            allowedNavigations = new Whitelist();

                                     ^

  symbol:   class Whitelist

  location: class org.apache.cordova.whitelist.WhitelistPlugin

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:62: error: cannot find symbol

            allowedIntents = new Whitelist();

                                 ^

  symbol:   class Whitelist

  location: class org.apache.cordova.whitelist.WhitelistPlugin

C:\Users\mango\Documents\GitHub\gPocket\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:63: error: cannot find symbol

            allowedRequests = new Whitelist();

                                  ^

  symbol:   class Whitelist

  location: class org.apache.cordova.whitelist.WhitelistPlugin

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

24 errors


> Task :app:compileDebugJavaWithJavac FAILED


FAILURE: Build failed with an exception.


* What went wrong:

Execution failed for task ':app:compileDebugJavaWithJavac'.

> Compilation failed; see the compiler error output for details.


* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.


* Get more help at https://help.gradle.org


Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.


You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.


See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings


BUILD FAILED in 36s

33 actionable tasks: 33 executed

Command failed with exit code 1: C:\Users\mango\Documents\GitHub\gPocket\platforms\android\gradlew cdvBuildDebug -b C:\Users\mango\Documents\GitHub\gPocket\platforms\android\build.gradle

[ERROR] An error occurred while running subprocess cordova.


        cordova.cmd build android exited with exit code 1. 


        Re-running this command with the --verbose flag may provide more

        information.




참조

https://github.com/apache/cordova-plugin-file-transfer/issues/316


Whitelist 는 cordova-android 10.1.x 이상부터는 필요없음

FileTransfer는 Whitelist를 종속해서 사용하지 않고 내장하는 식으로 업데이트함

github버전으로 File Transfer 추가한다

그래도 빌드시 whitelist 에러가 나면 제거


cordova plugin rm cordova-plugin-file-transfer

cordova plugin add https://github.com/apache/cordova-plugin-file-transfer 

cordova plugin rm cordova-plugin-whitelist




Eclipse 프로젝트에서 java.lang.NoClassDefFoundError 대처

Eclipse에서  자바 클래스 파일을 jar파일을 통해 추가 했을 때 소스 상에서는 클래스 파일을 찾지만 서버에 배포했을 때 못찾는 경우  프로젝트 옵션에서 Web Deplyment Assembly에 라이브러리 위치나 jar파일을 직접 추가하자   ...