본문 바로가기
WEB|WAS/Tomcat

tomcat war 구축시 생기는 에러

by 개폰지밥 2021. 5. 13.
반응형

- CSRF 에러

Context.xml

<Context allowCasualMultipartParsing="true"> 추가

 

- UserDatabase 에러

06-May-2021 11:15:05.171 심각 [main] org.apache.catalina.realm.UserDatabaseRealm.getUserDatabase [UserDatabase]() 사용하여 사용자 데이터베이스를 찾는 중 예외 발생
           javax.naming.NameNotFoundException: Name [UserDatabase]() 이 컨텍스트에 바인딩되지 않았습니다. [UserDatabase]() 찾을 수 없습니다.
                     at org.apache.naming.NamingContext.lookup(NamingContext.java:833)
                     at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
                     at org.apache.catalina.realm.UserDatabaseRealm.getUserDatabase(UserDatabaseRealm.java:259)
                     at org.apache.catalina.realm.UserDatabaseRealm.startInternal(UserDatabaseRealm.java:280)
                     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                     at org.apache.catalina.realm.CombinedRealm.startInternal(CombinedRealm.java:248)
                     at org.apache.catalina.realm.LockOutRealm.startInternal(LockOutRealm.java:116)
                     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                     at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
                     at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
                     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                     at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433)
                     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                     at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
                     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                     at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
                     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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
                     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)

-> $CATALINA_HOME/conf/Server.xml에서 Userdatabase 부분이 아래와 같이 주석되어있었는데 주석 풀어줌.

- SSL 접속문제

-> 8080 접속은 잘되는데 8443 접속은 안됨. 설정을 잘해줬다는 가정하에

1) 시간이 오래걸려서 접속이 안되는 거일수도있으니

connectionTimeout을 999999로 설정해준다 아래와 같이

2) SSL 방화벽을 허용했는지 확인하기

 

- 소켓 프로세서 실행 오류

10-May-2021 13:35:20.112 심각 [https-jsse-nio-8443-exec-8] org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun 소켓 프로세서 실행 중 오류 발생
        java.lang.NullPointerException
                at org.spongycastle.crypto.signers.PSSSigner.generateSignature(PSSSigner.java:189)
                at org.spongycastle.jcajce.provider.asymmetric.rsa.PSSSignatureSpi.engineSign(PSSSignatureSpi.java:161)
                at java.security.Signature$Delegate.engineSign(Signature.java:1382)
                at java.security.Signature.sign(Signature.java:698)
                at sun.security.ssl.ECDHServerKeyExchange$ECDHServerKeyExchangeMessage.<init>(ECDHServerKeyExchange.java:177)
                at sun.security.ssl.ECDHServerKeyExchange$ECDHServerKeyExchangeProducer.produce(ECDHServerKeyExchange.java:495)
                at sun.security.ssl.ClientHello$T12ClientHelloConsumer.consume(ClientHello.java:1020)
                at sun.security.ssl.ClientHello$ClientHelloConsumer.onClientHello(ClientHello.java:727)
                at sun.security.ssl.ClientHello$ClientHelloConsumer.consume(ClientHello.java:693)
                at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:377)
                at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
                at sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:968)
                at sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:955)
                at java.security.AccessController.doPrivileged(Native Method)
                at sun.security.ssl.SSLEngineImpl$DelegatedTask.run(SSLEngineImpl.java:902)
                at org.apache.tomcat.util.net.SecureNioChannel.tasks(SecureNioChannel.java:455)
                at org.apache.tomcat.util.net.SecureNioChannel.handshakeUnwrap(SecureNioChannel.java:519)
                at org.apache.tomcat.util.net.SecureNioChannel.handshake(SecureNioChannel.java:243)
                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1685)
                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
                at java.lang.Thread.run(Thread.java:748)

->

Java.security에서 “RSASSA-PSS”를 사용하지 않도록 설정하면 된다.

$JAVA_HOME/jre/lib/security/java.security

Ex) /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/lib/security/java.security

jdk.tls.disabledAlgorithmsRSASSA-PSS 추가

 

그 후 WAS 재기동 해준다.


참고:

https://stackoverflow.com/questions/65691480/nullpointerexception-at-org-bouncycastle-crypto-signers-psssigner-generatesignat

 

- LOG File 허가 거부 에러

java.util.logging.ErrorManager: 4
java.io.FileNotFoundException: /home/mydata1/MagicFIDO/apache-tomcat-9.0.45/logs/catalina.2021-05-12.log (허가 거부)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at org.apache.juli.FileHandler.openWriter(FileHandler.java:513)
at org.apache.juli.FileHandler.<init>(FileHandler.java:180)
at org.apache.juli.FileHandler.<init>(FileHandler.java:167)
at org.apache.juli.AsyncFileHandler.<init>(AsyncFileHandler.java:82)
at org.apache.juli.AsyncFileHandler.<init>(AsyncFileHandler.java:78)
at org.apache.juli.AsyncFileHandler.<init>(AsyncFileHandler.java:74)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:589)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:525)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:327)
at java.util.logging.LogManager$3.run(LogManager.java:399)
at java.util.logging.LogManager$3.run(LogManager.java:396)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:396)
at java.util.logging.LogManager.access$800(LogManager.java:145)
at java.util.logging.LogManager$2.run(LogManager.java:345)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
at java.util.logging.LogManager.getLogManager(LogManager.java:378)
at java.util.logging.Logger.demandLogger(Logger.java:448)
at java.util.logging.Logger.getLogger(Logger.java:502)
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:61)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:181)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:133)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:156)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:211)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:50)
java.util.logging.ErrorManager: 4

실수로 톰캣 실행계정이 아니라 root로 was를 시작해서 log의 소유자 권한이 root로 바꼈을 수도 있다.

그럴 때는 아래와 같이 소유자 권한을 바꿔준다.

chown -R user:group /바꿀 디렉토리 or 파일

ex chown -R mydata1:mydata1 . => 현재 폴더의 및 하위 디렉토리까지 소유자 권한을 모두 mydata1로 변경하겠다.

 

- JAVA 버전이 높아서 생기는 에러

- 에러 문구

07-Sep-2021 16:26:34.670 SEVERE [https-jsse-nio-8443-exec-7] org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun 소켓 프로세서 실행 중 오류 발생
        java.lang.NullPointerException: Cannot invoke "java.security.SecureRandom.nextBytes(byte[])" because "this.random" is null
                at

 

- 에러 원인 파악:

JAVA 버전이 높아서 생기는 에러로 파악

 

-  에러 해결시 수정사항

1) Jdk-8 버전으로 설치

JAVA 설치 버전:jdk-8u302-ojdkbuild-linux-x64

 

2) bash_profileJAVA_HOME Path 설정 및 적용

 

반응형

댓글