如何覆盖OpenJDK详细信息?

时间:2018-07-02 14:27:14

标签: java spring-batch

我正在使用Linux框并设置Oracle 12c实例和Java JDK此问题与classNotFound错误无关

[user@10.XXX-XX-00:~]$ java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)
[user@10.XXX-XX-00:~]$ javac -version
javac 1.8.0_144
[user@10.XXX-XX-00:~]$

也在 .profile 文件中。我设置了以下路径:

export JAVA_HOME=/usr/jdk1.8.0_144 #/usr/java
export ANT_HOME=/sys_apps_01/apache-ant-1.9.4
export M2_HOME=/sys_apps_01/apache-maven-2.2.1
export M2=$M2_HOME/bin
export ORACLE_HOME=/vol_01/oracle/product/v11.2.0.3/
export PATH=$M2:$PATH:$JAVA_HOME/bin:$ORACLE_HOME/bin

但是当我使用java -versionjavac -version时,为什么我要获取OpenJDK详细信息?

当我找到openJDK时。我什么都没得到。

[root@10.XXX-XX-00 ~]# find / -name "openjdk"
[root@10.XXX-XX-00 ~]#

对于用户,似乎已经设置了环境变量,而不是root用户。如何解决此错误?

应用程序给我以下错误-

java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.JceSecurity
    at javax.crypto.Cipher.getInstance(Cipher.java:653)
    at javax.crypto.Cipher.getInstance(Cipher.java:596)
    at com.mastercard.ess.eds.batch.mapper.RawRecordFieldSetMapper.decriptValue(RawRecordFieldSetMapper.java:126)
    at com.mastercard.ess.eds.batch.mapper.RawRecordFieldSetMapper.mapFieldSet(RawRecordFieldSetMapper.java:87)
    at com.mastercard.ess.eds.batch.mapper.RawRecordLineMapper.mapLine(RawRecordLineMapper.java:19)
    at com.mastercard.ess.eds.batch.mapper.RawRecordLineMapper.mapLine(RawRecordLineMapper.java:12)
    at org.springframework.batch.item.file.FlatFileItemReader.doRead(FlatFileItemReader.java:180)
    at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:88)
    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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
    at com.sun.proxy.$Proxy45.read(Unknown Source)
    at org.springframework.batch.item.support.SynchronizedItemStreamReader.read(SynchronizedItemStreamReader.java:55)
    at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:91)
    at org.springframework.batch.core.step.item.FaultTolerantChunkProvider.read(FaultTolerantChunkProvider.java:87)
    at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:116)
    at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)
    at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
    at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
    at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:110)
    at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:69)
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
    at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)
    at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

详细信息

  

uname -a

     

Linux ech-10-XXX-XX-00 2.6.32-696.13.2.el6.x86_64#1 SMP 10月5日星期四17:03:21 PDT 2017 x86_64 x86_64 x86_64 GNU / Linux

我找到了

/usr/lib/jvm
[user@:/usr/lib/jvm]$ ll
total 4.0K
drwxr-xr-x 3 root root 4.0K May 21 23:01 java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64
lrwxrwxrwx 1 root root   51 Jun 20 07:57 jre-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64 -> java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre
lrwxrwxrwx 1 root root   51 Jun 20 07:57 jre-1.8.0-openjdk.x86_64 -> java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre
lrwxrwxrwx 1 root root   21 Jun 20 07:57 jre -> /etc/alternatives/jre
lrwxrwxrwx 1 root root   29 Jun 20 07:57 jre-openjdk -> /etc/alternatives/jre_openjdk
lrwxrwxrwx 1 root root   27 Jun 20 07:57 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
[user@:/usr/lib/jvm]$

现在有指导吗?

1 个答案:

答案 0 :(得分:0)

仅因为设置了JAVA_HOME,并不意味着运行javajavac将从该目录中提取命令。

可执行文件的搜索路径实际上存储在PATH变量中。

尝试一下:

export PATH=$JAVA_HOME/bin:$PATH

这会将您定义的Java主页放置在路径的开头,这意味着在搜索java时,这将是检查的第一个位置。

要找到实际运行的二进制文件,请使用

which java
>/c/Program Files/Java/jdk1.8.0_151/bin/java