Java 错误:无法找到或加载主类 weblogic.security.Encrypt

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30943752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 10:24:10  来源:igfitidea点击:

Error: Could not find or load main class weblogic.security.Encrypt

javaeclipseencryptionweblogicweblogic12c

提问by Brian

I am trying to encrypt a database password for my Java EE Applicationin the terminal. according to this tutorial

我正在尝试Java EE Application在终端中为我的数据库密码加密。根据本教程

The steps are as follows:

步骤如下:

  1. Change directory to your domain's bin folder (For Eg. cd WLS_home\user_projects\domains\mydomain\bin)
  2. Use setDomainEnv.cmd/shscript to setup the environment
  3. Run java weblogic.security.Encryptwhich will prompt for the password and will print the encrypted value in stdout.
  1. 将目录更改为您域的 bin 文件夹(例如 cd WLS_home\user_projects\domains\mydomain\bin)
  2. 使用setDomainEnv.cmd/sh脚本设置环境
  3. 运行java weblogic.security.Encrypt这将提示输入密码并在标准输出中打印加密值。

However, when I execute 'java weblogic.security.Encrypt', I am presented with the following:

但是,当我执行“java weblogic.security.Encrypt”时,会看到以下内容:

Error: Could not find or load main class weblogic.security.Encrypt

错误:无法找到或加载主类 weblogic.security.Encrypt

I am developing my project in Eclipse and have configured my Weblogic-12.1.3server in Eclipse. I am not sure why this error is happening, but I expect its because my java version is 1.8, and maybe it expects me to use java 1.6 which I think comes with Weblogic installation.

我正在 Eclipse 中开发我的项目并在 Eclipse 中配置了我的Weblogic-12.1.3服务器。我不确定为什么会发生这个错误,但我希望它是因为我的 java 版本是 1.8,也许它希望我使用 java 1.6,我认为它是 Weblogic 安装附带的。

java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

回答by Brian Ochs

I am using Java 8 with WebLogic 12.1.3 on Linux. I had to add some classpath entries, but it worked like this:

我在 Linux 上使用 Java 8 和 WebLogic 12.1.3。我不得不添加一些类路径条目,但它的工作方式是这样的:

java -cp /home/devuser/Oracle/Middleware/Oracle_Home/wlserver/modules/features/*:/home/devuser/Oracle/Middleware/Oracle_Home/wlserver/modules/*  weblogic.security.Encrypt

回答by Luca

You must type
cd WLS_home/user_projects/domains/mydomain/bin/

你必须输入
cd WLS_home/user_projects/domains/mydomain/bin/

. ./setDomainEnv.sh

. ./setDomainEnv.sh

You must use two separate dots, that should do the trick!

您必须使用两个单独的点,这应该可以解决问题!

回答by Poornan

I had the same issue when I set set enableHotswapFlag=to true. please leave this flag empty and try.

当我设置set enableHotswapFlag=为 true时,我遇到了同样的问题。请将此标志留空并尝试。