みんな私はこれに苦労しています。systemoutからロギングをリダイレクトしようとしています。成功しなかったlog4jrollingappenderファイルに、以下は私のpersistent.xmlのサンプルです
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<persistence-unit name="R_TEST" transaction-type="RESOURCE_LOCAL">
<provider>
com.ibm.websphere.persistence.PersistenceProviderImpl
</provider>
<non-jta-data-source>jdbc/TESTDB</non-jta-data-source>
<class>com.ra.WSProcess</class>
<property name="openjpa.jdbc.Schema" value="TEST" />
<property name="openjpa.Log" value="log4j"/>
</properties>
</persistence-unit>
これを追加するとすぐに次のエラーが発生します:上記のファイルに。これらの2つのファイル(commons-logging-1.1.jar、log4j-1.2.6.jar)をWEB_INF / libにコピーしようとしましたが、問題は解決しませんでした。これをそのまま機能させる方法については、Web上ではあまり取り上げられていないようです。何か案は ?
Websphereでクラスローディングポリシーを変更できないことに注意してください。変更すると、アプリが機能しなくなります。
java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: org.apache.log4j.Priority
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at org.apache.openjpa.lib.log.Log4JLogFactory.newLogAdapter(Log4JLogFactory.java:33)
at org.apache.openjpa.lib.log.LogFactoryAdapter.getLog(LogFactoryAdapter.java:40)
at org.apache.openjpa.lib.conf.ConfigurationImpl.getLog(ConfigurationImpl.java:223)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getConfigurationLog(OpenJPAConfigurationImpl.java:1445)
at org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationProviderImpl.setInto(PersistenceProductDerivation.java:479)
at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCBrokerFactory.newInstance(WsJpaJDBCBrokerFactory.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:124)
at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:62)
at org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(PersistenceProviderImpl.java:102)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:81)
at com.ibm.websphere.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:71)
at com.ibm.websphere.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:41)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:109)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:53)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at com.ra.WSProcess.EntityManagerHelper.<clinit>(EntityManagerHelper.java:20)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at com.ra.WSProcess.process(WSProcess.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.apache.axis2.jaxws.server.dispatcher.JavaDispatcher.invokeTargetOperation(JavaDispatcher.java:76)
at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:96)
at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:108)
at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:159)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:182)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1330)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:859)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:347)