반응형
반응형
반응형

// node 버전 확인
$ node -v
v7.3.0

// 캐시 삭제
$ npm cache clean -f

// nodejs 버전관리 플러그인
$ npm install -g n 

// nodejs 업데이트
$ sudo n stable

// n latest  # 최신버전
// n lts     # lts 버전
// n stable  # 안정버전


// npm 버전 확인
$ npm -v
6.14.13


// npm 업데이트(global 경로)
$ sudo npm install -g npm 


// 설치 후 버전 확인.
$ node -v
v14.17.3

$ npm -v
7.20.0

반응형

'프로그래밍 > nodejs' 카테고리의 다른 글

nodejs 설치.  (0) 2020.03.02
package.json 설명 링크.  (0) 2018.09.12
반응형

현상 : 잘 돌아가고 있는 Java 프로세스에서 갑자기 에러 발생.

원인 : Java 프로세스가 떠 있는 상태에서 JDK 버전을 업데이트 해서 에러 발생.

해결 : Java 프로세스 재구동.

 

[WARN ] Failed to create a new channel from an accepted socket. {nioEventLoopGroup-3-1}
at io.netty.channel.socket.nio.NioServerSocketChannel.doReadMessages(NioServerSocketChannel.java:155)
java.lang.UnsatisfiedLinkError: no net in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at sun.net.ExtendedOptionsImpl.lambda$static$0(ExtendedOptionsImpl.java:48)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.ExtendedOptionsImpl.<clinit>(ExtendedOptionsImpl.java:47)
    at sun.nio.ch.SocketChannelImpl$DefaultOptionsHolder.defaultOptions(SocketChannelImpl.java:242)
    at sun.nio.ch.SocketChannelImpl$DefaultOptionsHolder.<clinit>(SocketChannelImpl.java:229)
    at sun.nio.ch.SocketChannelImpl.supportedOptions(SocketChannelImpl.java:251)
    at sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:169)
    at sun.nio.ch.SocketAdaptor.setBooleanOption(SocketAdaptor.java:271)
    at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:306)
    at io.netty.channel.socket.DefaultSocketChannelConfig.setTcpNoDelay(DefaultSocketChannelConfig.java:253)
    at io.netty.channel.socket.DefaultSocketChannelConfig.<init>(DefaultSocketChannelConfig.java:53)
    at io.netty.channel.socket.nio.NioSocketChannel$NioSocketChannelConfig.<init>(NioSocketChannel.java:470)
    at io.netty.channel.socket.nio.NioSocketChannel$NioSocketChannelConfig.<init>(NioSocketChannel.java:467)
    at io.netty.channel.socket.nio.NioSocketChannel.<init>(NioSocketChannel.java:106)
    at io.netty.channel.socket.nio.NioServerSocketChannel.doReadMessages(NioServerSocketChannel.java:151)
    at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:75)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)
[WARN ] Failed to create a new channel from an accepted socket. {nioEventLoopGroup-3-1}
at io.netty.channel.socket.nio.NioServerSocketChannel.doReadMessages(NioServerSocketChannel.java:155)
java.lang.NoClassDefFoundError: Could not initialize class sun.nio.ch.SocketChannelImpl$DefaultOptionsHolder
    at sun.nio.ch.SocketChannelImpl.supportedOptions(SocketChannelImpl.java:251)
    at sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:169)
    at sun.nio.ch.SocketAdaptor.setBooleanOption(SocketAdaptor.java:271)
    at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:306)
    at io.netty.channel.socket.DefaultSocketChannelConfig.setTcpNoDelay(DefaultSocketChannelConfig.java:253)
    at io.netty.channel.socket.DefaultSocketChannelConfig.<init>(DefaultSocketChannelConfig.java:53)
    at io.netty.channel.socket.nio.NioSocketChannel$NioSocketChannelConfig.<init>(NioSocketChannel.java:470)
    at io.netty.channel.socket.nio.NioSocketChannel$NioSocketChannelConfig.<init>(NioSocketChannel.java:467)
    at io.netty.channel.socket.nio.NioSocketChannel.<init>(NioSocketChannel.java:106)
    at io.netty.channel.socket.nio.NioServerSocketChannel.doReadMessages(NioServerSocketChannel.java:151)
    at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:75)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)

 

[/proc/16105/fd ] ls -al | grep java
15 -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre/lib/charsets.jar (deleted)
25 -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre/lib/jsse.jar (deleted)
4 -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre/lib/rt.jar (deleted)
7 -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre/lib/ext/cldrdata.jar (deleted)
8 -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre/lib/ext/localedata.jar (deleted)

 

 

반응형

'프로그래밍 > Java' 카테고리의 다른 글

Stream reduce 간단 설명  (0) 2023.05.20
java file.encoding  (0) 2022.07.12
Too many open files  (2) 2021.06.14
환경변수 값 읽어오기.  (0) 2021.04.05
[Spring Boot] log4jdbc 설정.  (1) 2020.01.16
반응형

Too many open files

java.io.IOException: Too many open files
Operation timed outerverSocketChannelImpl.accept0(Native Method)
    at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422)
    at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250)
    at io.netty.util.internal.SocketUtils$5.run(SocketUtils.java:119)
    at io.netty.util.internal.SocketUtils$5.run(SocketUtils.java:116)
    at java.security.AccessController.doPrivileged(Native Method)
    at io.netty.util.internal.SocketUtils.accept(SocketUtils.java:116)
    at io.netty.channel.socket.nio.NioServerSocketChannel.doReadMessages(NioServerSocketChannel.java:147)
    at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:75)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:748)


FD(File Descriptor/open files) 수가 부족한 경우 발생.

FD 사용 개수 확인.
$ lsof -p [PID] | wc -l
$ lsof -u [UID] | wc -l


Network connetion 개수 확인
$ netstat -an | wc -l

 

FD(File Descriptor/open files)
 - 프로세스가 가질 수 있는 소켓 포함 파일 개수
 - Java에서 소켓 통신(HTTP API, JDBC 커넥션 등)은 open file 옵션을 따라간다.


User Limit 확인
$ ulimit -aS


Hard Limit 확인
$ ulimit -aH


JDK 내부 코드상에서 Hard Limit 값이 soft limit에 update.
 - Java 프로세스는 Hard Limit 까지 file open 가능.


https://www.oracle.com/java/technologies/javase/vmoptions-jsp.html
$ java -XX:+PrintFlagsFinal -version | grep MaxFDLimit
     bool MaxFDLimit                                = true                                {product}
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

MaxFDLimit 옵션이 true일 경우 setrlimit 으로 limit을 증가.


Limit 설정.
$ vi /etc/security/limits.conf
계정명 soft nofile 40960
계정명 hard nofile 40960

보통 soft limit과 hard limit을 같은 값으로 설정한다.





Java에서 동시에 생성 가능한 쓰레드 수는 max user processes를 따라간다.

ps 명령어로 스레드 생성 개수를 확인(-L 옵션 : Show threads, possibly with LWP and NLWP columns.)
$ ps -efL | grep java | grep -v grep | wc -l
UID PID PPID LWP C NLWP STIME TTY TIME CMD

- PPID : 부모 프로세스 ID
- LWP : LWP(Light Weight Process, is thread). 쓰레드 ID
- C : CPU 사용율
- NLWP : LWP(Number Light Weight Process). 해당 프로세스에서 동작하고 있는 쓰레드 개수.
- STIME : 프로세스 시작 시간
- TIME : 총 CPU 사용 시간

반응형

'프로그래밍 > Java' 카테고리의 다른 글

java file.encoding  (0) 2022.07.12
[JAVA] java.lang.UnsatisfiedLinkError: no net in java.library.path  (1) 2021.06.25
환경변수 값 읽어오기.  (0) 2021.04.05
[Spring Boot] log4jdbc 설정.  (1) 2020.01.16
Rabbit MQ 간단 사용.  (0) 2018.12.21
반응형

OS / JVM 환경변구 값 읽어오기.

public static void main( String[] args ) {
                System.out.println("OS 환경변수 값");
                System.getenv().entrySet().forEach(e -> {
                        System.out.println("\t" + e.getKey() + "=" + e.getValue());
                });
                // export java_test_value="TEST VAL"
                System.out.println("OS 환경변수 java_test_value 값 = " + System.getenv("java_test_value"));


                System.out.println("");
                System.out.println("JVM 환경변수 값");
                Properties props = System.getProperties();
                for(Enumeration en = props.propertyNames(); en.hasMoreElements();) {
                        String key = (String)en.nextElement();
                        String value = props.getProperty(key);
                        System.out.println("\t" + key + "=" + value);
                }
                System.out.println("JVM 환경변수 user.name값 = " + System.getProperty("user.name"));
                System.out.println("JVM 환경변수 user.test값 = " + System.getProperty("user.test", "user.test property is null."));
}

 

반응형

'프로그래밍 > Java' 카테고리의 다른 글

[JAVA] java.lang.UnsatisfiedLinkError: no net in java.library.path  (1) 2021.06.25
Too many open files  (2) 2021.06.14
[Spring Boot] log4jdbc 설정.  (1) 2020.01.16
Rabbit MQ 간단 사용.  (0) 2018.12.21
singleton 객체.  (0) 2018.12.06
반응형

해결책 : www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html

 

M2Eclipse | Execution Not Covered

M2Eclipse 0.12 and earlier executed some parts of Maven build lifecycle inside Eclipse and then configured the Eclipse project based on after-execution state collected in MavenProject. This was controlled by many different sets of maven goals – goals whe

www.eclipse.org

 

환경설정 -> Maven -> Lifecycle Mapping

- Open workspace lifecycle mapping metadata  클릭.

xml 내용 추가.

<lifecycleMappingMetadata>
	<pluginExecutions>

		<!--
        에러가 발생하는 플러그인 위치를 작성한다.
		plugin
		 - groupId : org.codehaus.mojo
		 - artifactId : buildnumber-maven-plugin 
		   - execution
		     - goal : create-timestamp
		-->
		<pluginExecution>
			<pluginExecutionFilter>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>buildnumber-maven-plugin</artifactId>
				<versionRange>[1.0.0,)</versionRange>
				<goals>
					<goal>create-timestamp</goal>
				</goals>
			</pluginExecutionFilter>
			<action>
				<ignore />
			</action>
		</pluginExecution>
        
        ....
        
        <pluginExecution>
        ....
        </pluginExecution>
        
	</pluginExecutions>
</lifecycleMappingMetadata>

 

반응형

'프로그래밍' 카테고리의 다른 글

[git] error: src refspec master does not match any  (0) 2023.07.05
[JSTL] 조건식 eq, ne, empty  (0) 2016.12.07
인코딩  (0) 2014.03.24
[svn] 사용자 추가  (2) 2011.02.15
반응형

 

$ cd path/to/your/php/code

$ php -S localhost:8000

 

반응형

'프로그래밍 > PHP' 카테고리의 다른 글

이모지 제거.  (0) 2017.01.09
세션 관리. session id 가 계속 갱신되는 문제.  (0) 2016.03.10
[error] date_default_timezone_set()  (0) 2012.12.11
short_open_tag 설정.  (0) 2012.08.07
파일 업로드.  (0) 2012.07.11
반응형

npm : node package manager
nvm : node version manager

###################
# NVM 설치 #########
###################
https://github.com/nvm-sh/nvm#install-script
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
$ source .bash_profile


###################
# node 설치 ########
###################
$ nvm install node # "node" is an alias for the latest version

# 특정 버전 설치 시.
$ nvm install v12.16.1

# LTS 버전 설치 시.
$ nvm install --lts

# node 버전 확인.
$ node -v
v12.16.1

# 설치된 버전으로 사용.
$ nvm use node

# 특정 버전 사용 설정.
nvm use v12.16.1

# 환경 설정 적용.
$ source .bash_profile

# 설치된 Node.js 정보 조회
$ nvm ls


###################
# npm 업그레이드 #####
###################
# npm으로 npm을 설치.
npm install -g npm

반응형

'프로그래밍 > nodejs' 카테고리의 다른 글

[nodejs] 버전 업데이트  (0) 2021.07.20
package.json 설명 링크.  (0) 2018.09.12
반응형

spring boot 에서 Log4jdbc 를 사용해 실행된 쿼리 로그 확인.

1. log4jdbc를 dependency에 추가

<!-- log4jdbc -->
<dependency>
    <groupId>org.bgee.log4jdbc-log4j2</groupId>
    <artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
    <version>1.16</version>
</dependency>


2. datasource 설정.
 - spring.datasource.driverClassName 은 모든 DBMS 공통.
 - spring.datasource.url 은 jdbc-db name 사이에 log4jdbc 추가.
spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
spring.datasource.url=jdbc:log4jdbc:mysql://localhost:3306/test


3. log4j2 설정 파일 생성.
- 파일 path
resources/log4jdbc.log4j2.properties

 - 파일 내용.
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
log4jdbc.dump.sql.maxlinelength=0
(sql문 최대 출력 라인 수. 0:무제한, 미설정 : 한줄)


4. Logger 추가.

<logger name="jdbc" level="OFF"/>

<!-- SQL문만 로깅, PreparedStatement일 경우 관련된 argument 값으로 대체된 SQL문 출력 -->
<logger name="jdbc.sqlonly" level="OFF"/>

<!-- SQL문과 수행 시간 정보(milliseconds) 포함 -->
<logger name="jdbc.sqltiming" level="DEBUG"/>

<!-- ResultSet을 제외한 모든 JDBC 호출 정보 로깅. JDBC 문제를 추적해야 할 필요가 있는 경우에만 사용 -->
<logger name="jdbc.audit" level="OFF"/>

<!-- ResultSet을 포함한 모든 JDBC 호출 정보 로깅. 로그양이 많음 -->
<logger name="jdbc.resultset" level="OFF"/>

<!-- SQL 결과를 table 형태로 로깅 -->
<logger name="jdbc.resultsettable" level="DEBUG"/>

<!-- Connection의 연결과 종료에 관련된 로깅. 메모리 누수 확인? -->
<logger name="jdbc.connection" level="OFF"/>

 

※ Altibase  DB 에 적용 시.
VM옵션 추가 
   -Dlog4jdbc.drivers=Altibase.jdbc.driver.AltibaseDriver

 

반응형

'프로그래밍 > Java' 카테고리의 다른 글

Too many open files  (2) 2021.06.14
환경변수 값 읽어오기.  (0) 2021.04.05
Rabbit MQ 간단 사용.  (0) 2018.12.21
singleton 객체.  (0) 2018.12.06
openfire(xmpp) client  (0) 2018.11.06
반응형

Request 샘플.

 

 

POST /upload HTTP/1.1
content-type: multipart/form-data; boundary=--------------------------968146443668612378265595
content-length: 201783

----------------------------968146443668612378265595
Content-Disposition: form-data; name="upload_file"; filename="test.png"
Content-Type: image/png

[Binary Data]
----------------------------968146443668612378265595
Content-Disposition: form-data; name="userName"

myName
----------------------------968146443668612378265595
Content-Disposition: form-data; name="userAge"

25
----------------------------968146443668612378265595--

 

반응형

'프로그래밍 > Html' 카테고리의 다른 글

찾아보기 버튼 바꾸기  (0) 2016.08.05
simple table (아래 글의 css 적용)  (0) 2015.10.30
simple table css  (0) 2015.10.30
모바일웹에서 app 설치 확인  (0) 2014.03.24
모바일 웹  (0) 2014.03.24
반응형



// "guest"/"guest" by default, limited to localhost connections

ConnectionFactory factory = new ConnectionFactory();


factory.setHost("localhost");

factory.setPort(5672);

factory.setVirtualHost("/");

factory.setUsername("name");

factory.setPassword("pw");


//factory.setUri("amqp://name:pw@localhost:5672");


Connection conn = factory.newConnection();

Channel channel = conn.createChannel();


// autoDelete(true) : exchange 를 사용하는 곳이 없으면 삭제. durable 속성과는 상관없음.

// durable : 브로커 재시작 후에도 큐의 상태를 유지 여부.

//channel.exchangeDeclare("aiif.test", "direct", false/*durable*/, false/*autoDelete*/, null);




// exclusive

// connection close 되면 큐 삭제 됨.

// durable, autoDelete 속성과는 상관없음.

//channel.queueDeclare("ExclusiveQueue", false/*durable*/, true/*exclusive*/, false/*autoDelete*/, null);


// auto delete

// queue 에 consuming 하는 client 가 없으면 삭제.

// 일단 queue 를 생성 후 consuming 하는 client 가 있다가 없어진 경우에 삭제됨.

channel.queueDeclare("AutoDeleteQueue", false, false, false, null);


//channel.queueBind("AutoDeleteQueue", "aiif.test", "AutoDeleteQueue");


//DefaultConsumer consumer = new DefaultConsumer(channel);

final boolean autoAck = true;

String tag = channel.basicConsume("AutoDeleteQueue", autoAck/*auto ack*/, new DefaultConsumer(channel) {


        @Override

        public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {

                String message;

                if (body == null) {

                        message = "";

                        System.out.println("body null");

                } else {

                        message = new String(body);

                        System.out.println("message : " + message);

                }

                Map<String, Object> h = properties.getHeaders();

                System.out.println(h);


                String routingKey = envelope.getRoutingKey();

                String contentType = properties.getContentType();

                long deliveryTag = envelope.getDeliveryTag();

                System.out.println("routingKey : " + routingKey);

                System.out.println("contentType : " + contentType);

                System.out.println("deliveryTag : " + deliveryTag);



                MQMessage mqMessage = MQMessageMaker.make(message);

                System.out.println(mqMessage.toString());


                MQMessageBodyHB mqMessageBodyHB = (MQMessageBodyHB)mqMessage.getBody();

                System.out.println(mqMessageBodyHB.getLoad_level());

                System.out.println(mqMessageBodyHB.getAiif_id());


                if(!autoAck) {

                        channel.basicAck(deliveryTag, false/*multiple*/);

                }

        }

});


System.out.println("subscribe queue : AutoDeleteQueue");

//Thread.sleep(10000);


channel.basicCancel(tag);

System.out.println("unsubscribe queue : AutoDeleteQueue");

Thread.sleep(10000);


channel.queueDelete("AutoDeleteQueue");

System.out.println("delete queue : AutoDeleteQueue");

Thread.sleep(10000);


channel.close();

System.out.println("channel close");

Thread.sleep(10000);


conn.close();

System.out.println("connection close");



반응형

'프로그래밍 > Java' 카테고리의 다른 글

환경변수 값 읽어오기.  (0) 2021.04.05
[Spring Boot] log4jdbc 설정.  (1) 2020.01.16
singleton 객체.  (0) 2018.12.06
openfire(xmpp) client  (0) 2018.11.06
openfire 플러그인 개발.  (0) 2018.11.06

+ Recent posts