weblogic 启动报错java.net.UnknownHostException

当WebLogic服务器启动时遇到java.net.UnknownHostException错误,问题可能在于hosts文件缺少对机器名的IP映射。解决方法是编辑/etc/hosts文件,添加机器名及其对应的IP地址,例如127.0.0.1 XXXX(XXXX为机器名),保存后重新启动WebLogic,启动将恢复正常。
[root@XXXX base_domain]# ./startWebLogic.sh 
.
.
JAVA Memory arguments: -Xms6g -Xmx6g
.
WLS Start Mode=Production
.
CLASSPATH=/root/Oracle/Middleware/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/root/Oracle/Middleware/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/root/jrockit-jdk1.6.0_45-R28.2.7-4.1.0/lib/tools.jar:/root/Oracle/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/root/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:/root/Oracle/Middleware/modules/features/weblogic.server.modules_10.3.6.0.jar:/root/Oracle/Middleware/wlserver_10.3/server/lib/webservices.jar:/root/Oracle/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/root/Oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/root/Oracle/Middleware/wlserver_10.3/common/derby/lib/derbyclient.jar:/root/Oracle/Middleware/wlserver_10.3/server/lib/xqrl.jar
.
PATH=/root/Oracle/Middleware/wlserver_10.3/server/bin:/root/Oracle/Middleware/modules/org.apache.ant_1.7.1/bin:/root/jrockit-jdk1.6.0_45-R28.2.7-4.1.0/jre/bin:/root/jrockit-jdk1.6.0_45-R28.2.7-4.1.0/bin:/root/jrockit-jdk1.6.0_45-R28.2.7-4.1.0/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
.
***************************************************
*  To start WebLogic Server, use a username and   *
*  password assigned to an admin-level user.  For *
*  server administration, use the WebLogic Server *
*  console at http://hostname:port/console        *
***************************************************
starting weblogic with Java version:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Oracle JRockit(R) (build R28.2.7-7-155314-1.6.0_45-20130329-0641-linux-x86_64, compiled mode)
Starting WLS with line:
/root/jrockit-jdk1.6.0_45-R28.2.7-4.1.0/bin/java -jrockit   -Xms6g -Xmx6g -Dweblogic.Name=AdminServer -Djava.security.policy=/root/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.policy  -Dweblogic.ProductionModeEnabled=true   -da -Dplatform.home=/root/Oracle/Middleware/wlserver_10.3 -Dwls.home=/root/Oracle/Middleware/wlserver_10.3/server -Dweblogic.home=/root/Oracle/Middleware/wlserver_10.3/server   -Dweblogic.management.discover=true  -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole=false -Dweblogic.ext.dirs=/root/Oracle/Middleware/patch_wls1036/profiles/default/sysext_manifest_classpath:/root/Oracle/Middleware/patch_ocp371/profiles/default/sysext_manifest_classpath  weblogic.Server
<2014-2-12 上午11时19分42秒 CST> <Info> <Security> <BEA-090905> <Disabling CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true> 
<2014-2-12 上午11时19分42秒 CST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true> 
<2014-2-12 上午11时19分43秒 CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Oracle JRockit(R) Version R28.2.7-7-155314-1.6.0_45-20130329-0641-linux-x86_64 from Oracle Corporation> 
<2014-2-12 上午11时19分44秒 CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3.6.0  Tue Nov 15 08:52:36 PST 2011 1441050 > 
<2014-2-12 上午11时19分45秒 CST> <Info> <Security> <BEA-090065> <Getting boot identity from user.> 
Enter username to boot WebLogic server:weblogicdoc
Enter password to boot WebLogic server:
<2014-2-12 上午11时19分53秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING> 
<2014-2-12 上午11时19分53秒 CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool> 
<2014-2-12 上午11时19分55秒 CST> <Notice> <Log Management> <BEA-170019> <The server log file /root/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/logs/AdminServer.log is opened. All server side log events will be written to this file.> 
<2014-2-12 上午11时19分55秒 CST> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: java.lang.AssertionError: Could not obtain the localhost address. The most likely cause is an error in the network configuration of this machine.
java.lang.AssertionError: Could not obtain the localhost address. The most likely cause is an error in the network configuration of this machine.
at weblogic.server.channels.BasicServerChannelImpl.getLocalHost(BasicServerChannelImpl.java:59)
at weblogic.server.channels.BasicServerChannelImpl.<clinit>(BasicServerChannelImpl.java:54)
at weblogic.rjvm.t3.ProtocolHandlerT3$ChannelInitializer.<clinit>(ProtocolHandlerT3.java:37)
at weblogic.rjvm.t3.ProtocolHandlerT3.getDefaultServerChannel(ProtocolHandlerT3.java:42)
at weblogic.server.channels.ChannelService.createServerChannels(ChannelService.java:506)
Truncated. see log file for complete stacktrace
Caused By: java.net.UnknownHostException: XXXX: XXXX
at java.net.InetAddress.getLocalHost(InetAddress.java:1402)
at weblogic.server.channels.BasicServerChannelImpl.getLocalHost(BasicServerChannelImpl.java:57)
at weblogic.server.channels.BasicServerChannelImpl.<clinit>(BasicServerChannelImpl.java:54)
at weblogic.rjvm.t3.ProtocolHandlerT3$ChannelInitializer.<clinit>(ProtocolHandlerT3.java:37)
at weblogic.rjvm.t3.ProtocolHandlerT3.getDefaultServerChannel(ProtocolHandlerT3.java:42)
Truncated. see log file for complete stacktrace

<2014-2-12 上午11时19分55秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED> 
<2014-2-12 上午11时19分55秒 CST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down> 

<2014-2-12 上午11时19分55秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN> 

原因:

由于hosts文件中没有将机器名与IP地址映射。

解决办法:

打开/etc/hosts文件,果然发现没有配置机器名对应的ip地址,于是在文件里面加入: 127.0.0.1   XXXX     注:XXXX是机器名称。 保存后,再次启动weblogic正常启动。 

<think>好的,我现在需要解决用户提出的WebLogic启动时出现的“java.lang.Exception: adminToProduction”错误。首先,我得理解这个错误的具体原因。用户之前提到过在Idea和WebLogic环境下遇到了文件访问权限的问题,可能这个错误与部署配置或权限有关。 根据引用内容,用户之前尝试将WebLogic的自动部署目录指向Idea编译输出的路径,但遇到了访问拒绝的问题。现在这个adminToProduction错误可能也是类似的配置问题。首先,我应该考虑WebLogic的部署模式是否正确设置。WebLogic有两种部署模式:stage和nostage。在stage模式下,服务器会将部署文件复制到目标目录,而nostage模式则直接使用源目录中的文件。如果用户配置为nostage模式,但目录权限不正确,可能导致无法访问编译后的文件,从而引发错误。 接下来,检查权限问题。用户提到即使指向旧的编译文件也会报错,说明权限设置可能有问题。需要确认WebLogic服务运行的用户(比如weblogic用户)是否有权限读取Idea编译输出的目录。在Linux系统中,可能需要使用chmod或chown命令修改权限;在Windows上,则需要检查文件夹的安全属性,确保WebLogic进程有足够的访问权限。 另外,部署目录的配置是否正确也很重要。用户之前尝试将autodeploy目录指向Idea的输出路径,但可能存在路径配置错误,比如路径中包含空格或特殊字符,或者路径不存在。需要检查domain的配置文件(如config.xml)中的部署路径是否正确,并确保路径存在且可访问。 还有可能的是临时文件或缓存导致的问题。WebLogic可能会缓存旧的部署信息,导致冲突。清除临时目录(如domain目录下的servers、tmp、cache文件夹)可能会有帮助。同时,检查日志文件(如adminServer.log)中的详细错误信息,可以更准确地定位问题根源。 最后,考虑WebLogic版本和Idea插件的兼容性。如果使用的是较旧或较新的版本,可能存在已知的配置问题,需要查阅官方文档或社区支持,确认是否有相关的补丁或配置调整建议。</think>### WebLogic "adminToProduction" 异常解决方案 #### 1. 检查部署模式配置 WebLogic部署模式分为$stage$(默认)和$nostage$两种: - **stage模式**:部署文件会被复制到$domain/servers/<server_name>/stage$目录 - **nostage模式**:直接使用原始路径文件 **操作步骤**: 1. 登录WebLogic控制台 2. 进入`Deployments` -> 选择应用 -> `Configuration` -> `Deployment`页签 3. 确认`Staging Mode`设置为与部署目录匹配的模式 4. 若使用nostage模式,需确保路径权限正确[^1] #### 2. 验证文件系统权限(以Windows为例) ```powershell # 查看目录权限 icacls "E:\project\build\output" # 授予完全控制权限 icacls "E:\project\build\output" /grant weblogic:(OI)(CI)F ``` *注意:weblogic需替换为实际服务运行账户* #### 3. 清理临时文件 删除以下目录内容: ``` E:\weblogic\user_projects\domains\base_domain\servers\AdminServer\tmp E:\weblogic\user_projects\domains\base_domain\servers\AdminServer\cache ``` #### 4. 检查部署描述符 验证$weblogic.xml$配置: ```xml <weblogic-web-app> <container-descriptor> <prefer-web-inf-classes>true</prefer-web-inf-classes> </container-descriptor> </weblogic-web-app> ``` #### 5. 查看详细日志 分析$domain/servers/AdminServer/logs/AdminServer.log$,搜索关键错误上下文: ``` ####<时间戳> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "0000000000000000" for task "0". Error is: "weblogic.application.ModuleException: java.lang.Exception: adminToProduction"> ``` #### 6. 重置安全数据(备选方案) 停止服务后删除: ``` E:\weblogic\user_projects\domains\base_domain\servers\AdminServer\data\ldap\ E:\weblogic\user_projects\domains\base_domain\security\DefaultAuthenticatorInit.ldift ```
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值