我试图在运行于WebLogic 12.2.1的Web服务中添加log4j日志记录,但是以某种方式,日志记录无法正常工作。
这是我的WAR文件的WEB-INF \ classes中的log4j2.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
<Properties>
<Property name="log-path">E:/MLM/MyDomain/servers/MyAppSrv01/logs</Property>
</Properties>
<Appender type="File" name="File" fileName="${log-path}/Services.log" filePattern="${log-path}/Services-%d{yyyy-MM-dd}.log">
<Layout type="PatternLayout">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Layout>
</Appender>
<Loggers>
<Root level="INFO">
<AppenderRef ref="File"/>
</Root>
</Loggers>
</Configuration>
Run Code Online (Sandbox Code Playgroud)
这是我的Web服务代码的一部分:
@Path("TestWS")
@Consumes("text/plain")
@Produces("text/plain")
public class TestWS {
static private Logger logger = LogManager.getLogger();
public TestWS() {}
@GET
@Produces(MediaType.TEXT_PLAIN)
@Path("webservicemethod1")
public String webservicemethod1(@Context HttpServletRequest request) {
logger.error("In webservicemethod1");
....
}
}
Run Code Online (Sandbox Code Playgroud)
在我的WAR文件的WEB-INF \ lib \中,我有:
log4j-core-2.5.jar
log4j-api-2.5.jar
Run Code Online (Sandbox Code Playgroud)
我可以使用客户端程序成功调用Web服务。但是我根本看不到日志文件被创建。可能是什么问题呢?
提前致谢。
我正在尝试在weblogic服务器上部署带有war文件的Web项目。但是我遇到了类似上面的错误,
java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
at com.google.common.eventbus.EventBus.<init>(EventBus.java:138)
Run Code Online (Sandbox Code Playgroud)
我尝试了最新版本和最旧版本的番石榴。在最旧的版本中,我遇到了eventbus错误(在旧版本中未定义此方法)。在最新版本中,我再次遇到相同的错误。
我怎么解决这个问题?
编辑:它在我的编辑器(IntelliJ)中运行清晰,当我尝试在Weblogic服务器上运行它时,在部署中出现此错误。
更新:
我只是在WEB-INF路径中添加了一个如上所述的weblogic.xml文件。无需任何其他配置。@ luc14n0为我解决了问题
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
Run Code Online (Sandbox Code Playgroud) 我使用的是Hibernate 5.2.10.Final,log4j 1.2.17(从此处开始),Weblogic 12.2.1。这是我的log4j.xml样子:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC
"-//APACHE//DTD LOG4J 1.2//EN" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%5p] %d{yyyy-MM-dd HH:mm:ss} [%x] [%C.%M] - %m %n" />
</layout>
</appender>
<appender name="logFile" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="../logs/mylog.log"/>
<param name="MaxFileSize" value="100MB"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="[%5p] %d{yyyy-MM-dd HH:mm:ss} - %m %n" />
</layout>
</appender>
<logger name="interceptorLog" additivity="false">
<level value="INFO" />
<appender-ref ref="logFile" />
</logger>
<root>
<priority value="ALL" />
<appender-ref ref="logFile"/> …Run Code Online (Sandbox Code Playgroud) 我多年来一直在使用 Tomcat、JBoss、Glassfish 等。在这些容器中,我使用了 Log4j、JDK Logging 等。这非常简单。
我正在努力从 Weblogic 12c 中的应用程序中获取任何日志记录。日志被写入 stderr 而不是日志文件。
private final static Logger log = Logger.getLogger(TestingService.class.getName());
log.log(Level.SEVERE,"My log " + text);
Run Code Online (Sandbox Code Playgroud)
在管理控制台日志实现中:JDK 严重级别:INFO
如果我按照 log4j Weblogic 配置过程配置 Log4J,则行为是相同的。
我想使用命令行强制关闭 weblogic 服务器。我有一个特定的场景。我编写了一个批处理文件来做一些事情,然后使用stopWebLogic.cmd如下方式关闭 weblogic 服务器:
"%WEBLOGIC_DOMAIN_PATH%\bin\stopWebLogic.cmd"
Run Code Online (Sandbox Code Playgroud)
我已经浏览了这个文件。但我不能遵循这种方法,因为我不想改变stopWebLogic.cmd。有没有办法实现这一目标?
我需要帮助来提取 WLS,我尝试使用 CMD 安装 WebLogic Server,并且我已经设置了 java_home。但我有以下错误:
提取安装程序。. . . . . 完成
此安装程序必须使用 Java 开发工具包 (JDK) 执行,
但 C:\Program Files\Java\jre7 不是有效的 JDK Java Home。
日志位于:C:\Users\E440\AppData\Local\Temp\OraInstall2016-12-18_05-38-26AM\launcher2016-12-18_05-38-26AM.log。按 Enter 退出
我试图设置 JAVA_HOME
C:\Oracle\FMW>set java_home
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_79
这就是我在环境变量中设置的路径,但它仍然显示相同的错误。
我将命令更改为指定的oracle home
C:\Oracle\FMW>java -jar fmw_12.2.1.2.0_wls_quick.jar oracle_home=C:\app\user\product\11.2.0\dbhome
但是再次错误仍然相同。
在C:\ Program Files文件\的Java \ jre7 路径甚至没有在我的环境变量。
有什么我错过了吗?
我收到以下错误。
java.lang.RuntimeException: java.lang.RuntimeException: 请求的属性未通过 JMX 公开:setEnabled
我该如何解决这个问题。
这是我在 WLST(Weblogic Scripting Tool)中尝试过的一组命令。
wls:/MiCommApp/serverConfig> cd('/Servers/' 'AdminServer' '/SSL/' 'AdminServer' )
wls:/MiCommApp/serverConfig/Servers/AdminServer/SSL/AdminServer> cmo.setEnabled(true)
Traceback (innermost last):
File "<console>", line 1, in ?
at weblogic.management.jmx.ExceptionMapper.matchJMXException(ExceptionMapper.java:74)
at weblogic.management.jmx.MBeanServerInvocationHandler.doInvoke(MBeanServerInvocationHandler.java:508)
at weblogic.management.jmx.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:382)
at com.sun.proxy.$Proxy16.setEnabled(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
java.lang.RuntimeException: java.lang.RuntimeException: The requested attribute
is not exposed through JMX: setEnabled
Run Code Online (Sandbox Code Playgroud) 我需要从 java 类加载一个静态 PDF 文档,该文档在 WebLogic 12c 上的 J2EE Web 应用程序中运行;然而,尽管我的代码可以在 Tomcat 中运行,但当尝试在 WebLogic 12c(WebLogic Server 版本:12.2.1.2.0)中运行它时,我收到一个服务器错误,指出找不到 PDF 文件(java.io.FileNotFoundException)。
我正在使用 Apache 的 PDF 库 PDFBox 版本 2.0.8 加载我创建的可填写 PDF 文件,然后用数据填充该可填写 PDF。我的代码在 Tomcat 中运行良好,但在部署到 WebLogic 12c 时找不到 pdf 文件。
-这似乎是因为当 EAR 文件部署到 WebLogic 12c 时,WAR 文件中的内容(所有应用程序代码/文件,包括可填写的 PDF 文件)仍然存档在 WebLogic 创建的 jar 文件中,而不是爆炸了。
我的应用程序使用标准的 Maven 应用程序结构,因此与所有静态文件都是标准的,我已将 PDF 文件放在静态资源目录中:
src/主/资源/
在我的 pom.xml 文件中,我有以下内容,它将 /src/main/resources/ 文件夹中的所有 pdf 文件构建到 WAR 文件的类路径根文件夹中。
<resource>
<directory>${basedir}/src/main/resources/</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
<include>**/*.pdf</include>
</includes>
</resource>
Run Code Online (Sandbox Code Playgroud)
当我构建 WAR 和 EAR 文件时,pdf 文件确实被复制到应用程序类文件的根文件夹中。 …
我尝试添加
\n\n <enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>\nRun Code Online (Sandbox Code Playgroud)\n\n在 weblogic 服务器 12.1.3 的 config.xml 中的标签内<security-configuration>添加此行后,每当我启动服务器时,我的 weblogic 服务器都会关闭。
有什么不对?我已在下面附上我的 config.xml 内容
\n\n <domain-version>12.1.3.0.0</domain-version>\n <security-configuration>\n <name>mdm_domain</name>\n <realm>\n <sec:authentication-provider xsi:type="wls:default-authenticatorType">\n <sec:name>DefaultAuthenticator</sec:name>\n </sec:authentication-provider>\n <sec:authentication-provider xsi:type="wls:default-identity-asserterType">\n <sec:name>DefaultIdentityAsserter</sec:name>\n <sec:active-type>AuthenticatedUser</sec:active-type>\n </sec:authentication-provider>\n <sec:role-mapper xmlns:xac="http://xmlns.oracle.com/weblogic/security/xacml" xsi:type="xac:xacml-role-mapperType">\n <sec:name>XACMLRoleMapper</sec:name>\n </sec:role-mapper>\n <sec:authorizer xmlns:xac="http://xmlns.oracle.com/weblogic/security/xacml" xsi:type="xac:xacml-authorizerType">\n <sec:name>XACMLAuthorizer</sec:name>\n </sec:authorizer>\n <sec:adjudicator xsi:type="wls:default-adjudicatorType">\n <sec:name>DefaultAdjudicator</sec:name>\n </sec:adjudicator>\n <sec:credential-mapper xsi:type="wls:default-credential-mapperType">\n <sec:name>DefaultCredentialMapper</sec:name>\n </sec:credential-mapper>\n <sec:cert-path-provider xsi:type="wls:web-logic-cert-path-providerType">\n <sec:name>WebLogicCertPathProvider</sec:name>\n </sec:cert-path-provider>\n <sec:cert-path-builder>WebLogicCertPathProvider</sec:cert-path-builder>\n <sec:name>myrealm</sec:name>\n <sec:password-validator xmlns:pas="http://xmlns.oracle.com/weblogic/security/providers/passwordvalidator" xsi:type="pas:system-password-validatorType">\n <sec:name>SystemPasswordValidator</sec:name>\n <pas:min-password-length>8</pas:min-password-length>\n <pas:min-numeric-or-special-characters>1</pas:min-numeric-or-special-characters>\n </sec:password-validator>\n </realm>\n <default-realm>myrealm</default-realm>\n <credential-encrypted>{AES}lWxYlHpEqfbODbLmeerJr6H86R6+lvszW466UpoYzuyh6X617HokRf/oKl3cZJM+JTXliBWwXFhAiC9G3JrbxYNBkXMUGqFSOicuMVJVD0tTCuTr6sfY7UPK9M40Vi4n</credential-encrypted>\n <node-manager-username>weblogic</node-manager-username>\n <node-manager-password-encrypted>{AES}loTlWUtqsyw7sq4ujEhLVDaHCv/s7k22k0KSacFO/Ww=</node-manager-password-encrypted>\n <enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>\xc2\xa0\n </security-configuration>\nRun Code Online (Sandbox Code Playgroud)\n 我刚刚完成了Oracle Fusion Middleware 12c的全新安装.这个附带了新版本的Weblogic 12.2.1.3.0.每当我尝试创建新的JDBC连接时,我都会收到以下错误.
<BEA-240003> <Administration Console encountered the following error: java.sql.SQLException: Could not establish a connection because of java.lang.IllegalArgumentException: ONS configuration failed
at weblogic.jdbc.common.internal.DataSourceUtil.testConnection0(DataSourceUtil.java:423)
at weblogic.jdbc.common.internal.DataSourceUtil.access$000(DataSourceUtil.java:24)
at weblogic.jdbc.common.internal.DataSourceUtil$1.run(DataSourceUtil.java:285)
at java.security.AccessController.doPrivileged(Native Method)
at weblogic.jdbc.common.internal.DataSourceUtil.testConnection(DataSourceUtil.java:282)
at com.bea.console.utils.jdbc.JDBCUtils.testConnection(JDBCUtils.java:937)
at com.bea.console.actions.jdbc.datasources.creategridlinkdatasource.CreateGridLinkDataSource.testJDBCConnection(CreateGridLinkDataSource.java:615)
at com.bea.console.actions.jdbc.datasources.creategridlinkdatasource.CreateGridLinkDataSource.testRACConnectionConfiguration(CreateGridLinkDataSource.java:437)
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.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:870)
at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809)
at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478)
at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306)
at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336)
at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:52)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:64)
at org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor.wrapAction(ActionInterceptor.java:184)
at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.invoke(ActionInterceptors.java:50)
at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:58)
at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:87)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116) …Run Code Online (Sandbox Code Playgroud)