I have a web application that is deployed locally to a Liberty Profile server, and that is already working with log4j2. My end goal is to log all of the PreparedStatements with their parameter values included in the query string, just before they are run against a DB2 database.
I've been following the instructions at https://code.google.com/p/log4jdbc-log4j2 to set up log4jdbc-log4j2. I was able to pull down the dependency files with Maven:
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4</artifactId>
<version>1.16</version>
</dependency>
However, I've been stuck at steps 3.1 and 3.2 for awhile, and so far, nothing on stackoverflow or instructional blogs has helped me move forward, so I thought it was time to ask my own question.
Could someone please let me know in which file(s), and how, I should make the changes mentioned in steps 3.1 ("Change your JDBC URL") and 3.2 ("Change the driver used")? Please let me know if there's something I can clarify further in order to help get my question answered, and thank you in advance for any help or guidance you can provide.
Update
After making the changes to server.xml suggested aguibert and including all log4j*.jar files from the dependency in the db2 drivers directory, my server.xml entry looks like this:
<dataSource id="myDataSource" jndiName="jdbc/myDataSource" type="javax.sql.DataSource">
<jdbcDriver javax.sql.DataSource="net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy">
<library>
<fileset dir="<path to dir>/db2" includes="db2jcc_license_cisuz.jar db2jcc4.jar log4j-api-2.3.jar log4j-core-2.3.jar log4jdbc-log4j2-jdbc4-1.16-sources.jar log4jdbc-log4j2-jdbc4-1.16.jar"/>
</library>
</jdbcDriver>
<properties
password="password"
user="user"
URL="jdbc:log4jdbc:db2://<normal jdbc url>" />
</dataSource>
Now, when the first query is made, I get an InstantiationException on net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy:
java.lang.Exception:
at <my files>
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595) [com.ibm.ws.javaee.servlet.3.0_1.0.8.jar:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) [com.ibm.ws.javaee.servlet.3.0_1.0.8.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1285) [com.ibm.ws.webcontainer_1.0.8.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:776) [com.ibm.ws.webcontainer_1.0.8.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:473) [com.ibm.ws.webcontainer_1.0.8.jar:?]
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1104) [com.ibm.ws.webcontainer_1.0.8.jar:?]
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4845) [com.ibm.ws.webcontainer_1.0.8.jar:?]
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:297) [com.ibm.ws.webcontainer_1.0.8.jar:?]
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981) [com.ibm.ws.webcontainer_1.0.8.jar:?]
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262) [com.ibm.ws.webcontainer_1.0.8.jar:?]
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:955) [com.ibm.ws.transport.http_1.0.8.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_60]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_60]
Caused by: javax.naming.NamingException: CWWKN0008E: An object could not be obtained for name jdbc/myDataSource.
at com.ibm.ws.jndi.internal.WSContext.resolveObject(WSContext.java:128) ~[?:?]
at com.ibm.ws.jndi.internal.WSContext.lookup(WSContext.java:364) ~[?:?]
at com.ibm.ws.jndi.internal.WSContext.lookup(WSContext.java:359) ~[?:?]
at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161) ~[?:?]
at javax.naming.InitialContext.lookup(InitialContext.java:411) ~[?:1.7.0_60]
at <my files>
... 16 more
[ERROR ] CWWKE0701E: FrameworkEvent ERROR Bundle:com.ibm.ws.jdbc(id=69) org.osgi.framework.ServiceException: Exception in com.ibm.ws.resource.internal.ResourceFactoryTrackerData$1.getService()
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:222)
at [internal classes]
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at <my files>
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1285)
at [internal classes]
Caused by: java.lang.RuntimeException: java.sql.SQLNonTransientException: java.lang.InstantiationException: net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy
at com.ibm.ws.resource.internal.ResourceFactoryTrackerData$1.getService(ResourceFactoryTrackerData.java:109)
... 10 more
Caused by: java.sql.SQLNonTransientException: java.lang.InstantiationException: net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy
at com.ibm.ws.jdbc.internal.JDBCDriverService.create(JDBCDriverService.java:287)
... 10 more
Caused by: java.lang.InstantiationException: net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy
at java.lang.Class.newInstance(Class.java:359)
at com.ibm.ws.jdbc.internal.JDBCDriverService$1.run(JDBCDriverService.java:228)
... 10 more
Event:org.osgi.framework.FrameworkEvent[source=com.ibm.ws.jdbc_1.0.8.cl50520150305-2202 [69]]
If it looks like there's anything that I've missed, please let me know. Searching for the errors in the stack trace hasn't resulted in any solutions.
Final Status
As aguibert pointed out, it seems like a different direction will be best here. Based on a comment in Logging PreparedStatements in Java, I've decided to implement a LoggableStatement wrapper as described here: ibm.com/developerworks/java/library/j-loggable
For a WebSphere Liberty server, all of the global server config is done in the server.xml file (located by defualt at WLP_INSTALL/usr/servers//server.xml).
You will probably want something along these lines in your server.xml:
<dataSource id="myDataSource" jndiname="jdbc/myDataSource" type="javax.sql.DataSource">
<jdbcDriver javax.sql.DataSource="net.sf.log4jdbc.sql.jdbcapi.DataSourceSpy">
<library>
<fileset dir="C:/path/to/libs" includes="thedb2jar.jar log4j.jar" />
</library>
</jdbcDriver>
<properties user="user" password="password"
url="jdbc:log4jdbc:<the normal jdbc url>"/>
</dataSource>
The key parts here is that the element has the "javax.sql.DataSource" property set and the value is the name of the DataSource class for the log4j jar. Also, in the element, you'll see that the url is specified with the "jdbc:log4jdbc" prefix as described in section 3.1.
This is untested advice, but you may need to include both jars (the db2 jar and the log4j jar) in the same folder so they are picked up in the same element.
Related
We want to deploy our Applications (.war-Files) via Tomcat 8.5 into a k8s-infrastructure, having the depending Database on Google Cloud SQL (MySQL).
Google offers the MySQL-Connector-Librarys ( see https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/blob/main/docs/jdbc-mysql.md & https://cloud.google.com/sql/docs/mysql/connect-connectors), sadly with only documentation about implementation into the java application itself.
for company strategic reasons we don't want to do that.
We already tried to use a fat jar with all the dependencies of the mysql-connector and put that (together with the connectorJ/8.jar) into the tomcat/libs/ directory and configured the resource in the server.xml as follows:
<Resource name="jdbc/cloudSQL" auth="Container" type="javax.sql.DataSource" maxTotal="100" maxIdle="30" maxWaitMillis="10000"
factory="com.google.cloud.sql.mysql.SocketFactory" driverClassName="com.mysql.cj.jdbc.Driver" removeAbandonedOnBorrow="true" removeAbandonedTimeout="60" logAbandoned="true"
username="${db.user}" password="${db.pass}" url="jdbc:mysql:///${db.name}?cloudSqlInstance=${db.instance}&autoReconnect=true"
testOnBorrow="true" validationQuery="SELECT 1" />
Doesn't work too bad, but is not successfully either:
javax.naming.NamingException: Could not create resource factory instance
[Root exception is java.lang.ClassCastException: com.google.cloud.sql.mysql.SocketFactory cannot be cast to javax.naming.spi.ObjectFactory]
at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:86)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:332)
at org.apache.naming.NamingContext.lookup(NamingContext.java:846)
at org.apache.naming.NamingContext.lookup(NamingContext.java:157)
at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:115)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:69)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:32)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:138)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:145)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:112)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:87)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:787)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:695)
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.catalina.startup.Bootstrap.start(Bootstrap.java:345)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: java.lang.ClassCastException: com.google.cloud.sql.mysql.SocketFactory cannot be cast to javax.naming.spi.ObjectFactory
at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:75) ... 22 more
I'd appreciate any idea how to tackle this issue.
I replicate the issue on Google Cloud, then instead of using the library from Google Cloud I was able to connect to Cloud SQL using Connector/J following the Tomcat instructions (https://tomcat.apache.org/tomcat-8.5-doc/jndi-datasource-examples-howto.html)
I have started having failures on hive command as follows:
Logging initialized using configuration in file:/usr/local/someuser/hive/conf/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:346)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625)
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)
at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1412)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:62)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:72)
at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2453)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2465)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:340)
... 7 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1410)
... 12 more
Caused by: javax.jdo.JDOFatalUserException: There is no available StoreManager of type "rdbms". Make sure that you have put the relevant DataNucleus store plugin in your CLASSPATH and if defining a connection via JNDI or DataSource you also need to provide persistence property "datanucleus.storeManagerType"
NestedThrowables:
org.datanucleus.exceptions.NucleusUserException: There is no available StoreManager of type "rdbms". Make sure that you have put the relevant DataNucleus store plugin in your CLASSPATH and if defining a connection via JNDI or DataSource you also need to provide persistence property "datanucleus.storeManagerType"
at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:528)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:788)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:333)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:202)
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)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1965)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1960)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1166)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)
at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:310)
at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:339)
at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:248)
at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:223)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
at org.apache.hadoop.hive.metastore.RawStoreProxy.<init>(RawStoreProxy.java:58)
at org.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:67)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:497)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:475)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:523)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:397)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.<init>(HiveMetaStore.java:356)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:54)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:59)
at org.apache.hadoop.hive.metastore.HiveMetaStore.newHMSHandler(HiveMetaStore.java:4944)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:171)
... 17 more
Caused by: org.datanucleus.exceptions.NucleusUserException: There is no available StoreManager of type "rdbms". Make sure that you have put the relevant DataNucleus store plugin in your CLASSPATH and if defining a connection via JNDI or DataSource you also need to provide persistence property "datanucleus.storeManagerType"
at org.datanucleus.NucleusContext.createStoreManagerForProperties(NucleusContext.java:1217)
at org.datanucleus.NucleusContext.initialise(NucleusContext.java:356)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:775)
... 46 more
Here is the hive-site
<configuration>
<property>
<name>mapred.reduce.tasks</name>
<value>6</value>
<name>mapred.map.tasks</name>
<value>7</value>
</property>
<property>
<name>hive.exec.scratchdir</name>
<value>/data/cloud/hive/logs/hive-${user.name}</value>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/data/cloud/hive/logs/hive-${user.name}</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://somehost:3306/hive?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>xx</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>xx</value>
<description>password to use against metastore database</description>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
</configuration>
the version is 0.13.1
I have checked the lib directories of hadoop and hive both, as the logs complains about the classpath, but the jar datanucleus-rdbms-3.2.9.jar is already in the folder. I have tried to restart the metastore service as well but it didnt help at all.
any other point which might cause the error above? i was curious if there were any config changes prior to the errors, but it seems like no config updates either...
EDIT
Verbose logs: http://pastebin.com/jggaXF1X
After digging the logs, as we were discussing with #NeilStockton in the comments, i have tried to redownload the related jar file, in the folder where the jar itself already exists... and it worked after the redownload...
I've a web application which sending mail. To perform sending mail I use library which itself based on Apache Commons Email 1.4. When I've used Websphere Liberty 8.5.5.7 everything worked fine, but after I've upgraded to 8.5.5.9 it stopped to work and throwing an exception: javax.mail.NoSuchProviderException the full stack trace I posted at the end of the question.
Again, I've tried to run it on both installations of Websphere Liberty 8.5.5.7 and 8.5.5.9, on first one it works fine on second it's broken. I've tried to look what the difference and it looks that Liberty itself has com.ibm.ws.javax.mail-1.5_1.5.xx.jar package which interfere with Java javax-mail-1.5.2 which used by commons-email 1.4, see its pom.xml here.
After some debugging I've paid attention that:
Liberty 8.5.5.9 uses com.ibm.ws.javax.mail-1.5_1.5.12.jar while Liberty 8.5.5.7 uses com.ibm.ws.javax.mail-1.5_1.5.10.jar possible this is caused to my bug.
So, my question is how can I eliminate the influence of com.ibm.ws.javax.mail which comes together with liberty to make it work or is there another workaround?
Also, where can I submit bug report for Liberty Team?
Update:
It looks that Liberty has JavaMail 1.5 feature which can be enabled or disabled, I didn't enable it explicitly, it looks that on of my features enabled it implicitly, this is my features list:
<featureManager>
<feature>jdbc-4.1</feature>
<feature>adminCenter-1.0</feature>
<feature>jndi-1.0</feature>
<feature>localConnector-1.0</feature>
<feature>servlet-3.1</feature>
<feature>ssl-1.0</feature>
<feature>jaxrs-2.0</feature>
<feature>cdi-1.2</feature>
<feature>ejbLite-3.2</feature>
<feature>jsf-2.2</feature>
</featureManager>
Update 2
I've solved this issue by using this article: Overriding a provided API with an alternative version
Just make in your server.xml the following changes:
<application id="" name="Scholar" type="ear" location="scholar.ear">
<classloader delegation="parentLast" />
</application>
And now your libraries will receive higher precedence then Liberty's libraries.
Full stack trace of the exception:
org.apache.commons.mail.EmailException: Sending the email to the following server failed : relay.******.com:25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421) ~[commons-email-1.4.jar:1.4]
at org.apache.commons.mail.Email.send(Email.java:1448) ~[commons-email-1.4.jar:1.4]
at my.package.mailer.sendHtmlMail(IBMMail.java:96) ~[classes/:?]
at my.package.mailer.EmailGateway.sendMail(EmailGateway.java:24) [classes/:?]
at my.package.mailer.EventMailGateway.eventCreatedNotification(EventMailGateway.java:52) [classes/:?]
at **********.restful.EventsAPI.saveEvent(EventsAPI.java:99) [classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
at com.ibm.ws.jaxrs20.server.LibertyJaxRsServerFactoryBean.performInvocation(LibertyJaxRsServerFactoryBean.java:636) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.performInvocation(LibertyJaxRsInvoker.java:115) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:97) [cxf-core-3.0.3.jar:3.0.3]
at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.invoke(LibertyJaxRsInvoker.java:210) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200) [cxf-rt-frontend-jaxrs-3.0.3.jar:3.0.3]
at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.invoke(LibertyJaxRsInvoker.java:381) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) [cxf-rt-frontend-jaxrs-3.0.3.jar:3.0.3]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.0.3.jar:3.0.3]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.0.3.jar:3.0.3]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) [cxf-core-3.0.3.jar:3.0.3]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:124) [com.ibm.ws.jaxrs-2.0.common_1.0.12.jar:3.0.3]
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:256) [cxf-rt-transports-http-3.0.3.jar:3.0.3]
at com.ibm.ws.jaxrs20.endpoint.AbstractJaxRsWebEndpoint.invoke(AbstractJaxRsWebEndpoint.java:134) [com.ibm.ws.jaxrs-2.0.common_1.0.12.jar:?]
at com.ibm.websphere.jaxrs.server.IBMRestServlet.handleRequest(IBMRestServlet.java:149) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at com.ibm.websphere.jaxrs.server.IBMRestServlet.doPost(IBMRestServlet.java:107) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [com.ibm.ws.javaee.servlet.3.1_1.0.12.jar:?]
at com.ibm.websphere.jaxrs.server.IBMRestServlet.service(IBMRestServlet.java:99) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:778) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1161) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:82) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:928) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:955) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:341) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:256) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018) [com.ibm.ws.channelfw_1.0.12.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: javax.mail.NoSuchProviderException: smtp
at javax.mail.Session.getService(Session.java:820) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Session.getTransport(Session.java:742) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Session.getTransport(Session.java:682) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Session.getTransport(Session.java:662) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Session.getTransport(Session.java:719) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Transport.send0(Transport.java:248) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Transport.send(Transport.java:124) ~[javax.mail-1.5.2.jar:1.5.2]
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411) ~[commons-email-1.4.jar:1.4]
... 48 more
I've solved this issue by using this article: Overriding a provided API with an alternative version
Just make in your server.xml the following changes:
<application id="" name="Scholar" type="ear" location="scholar.ear">
<classloader delegation="parentLast" />
</application>
And now your libraries will receive higher precedence then Liberty's libraries.
I hit javax.mail.NoSuchProviderException: smtp after updating from Liberty 8.5.5.8 to 8.5.5.9. Adding <feature>javaMail-1.5</feature> to my server.xml worked for me.
Hello I'm having hard time trying to configure weblogic for stateless bean (Spring). I'm new on that field.
I'm having 2-layer application. Server (weblogic + DB + java app) and client written in swing. When calling this line:
getCtx().lookup(SomeStatelessRemoteHome.class.getName()), SomeStatelessRemoteHome.class);
I got this error:
Caused by: javax.naming.CommunicationException [Root exception is weblogic.rjvm.PeerGoneException: ; nested exception is:
java.io.EOFException]
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:74)
at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:472)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:428)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:412)
at javax.naming.InitialContext.lookup(Unknown Source)
at pl.com...SomeStatelessRemoteLbkProxy.<init>(SomeStatelessRemoteLbkProxy.java:49)
... 46 more
Caused by: weblogic.rjvm.PeerGoneException: ; nested exception is:
java.io.EOFException
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at weblogic.jndi.internal.ServerNamingNode_1036_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:424)
... 49 more
Caused by: java.io.EOFException
at weblogic.rjvm.t3.MuxableSocketT3.endOfStream(MuxableSocketT3.java:345)
at weblogic.socket.SocketMuxer.deliverExceptionAndCleanup(SocketMuxer.java:827)
at weblogic.socket.SocketMuxer.deliverEndOfStream(SocketMuxer.java:761)
at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:958)
at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:889)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:339)
at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
EJB is auto-deployed on server. I've run weblogic with debug properties and there is nothing in log on weblogic server. Only on client it shows this stacktrace.
After ocurring of this exception weblogic lose all connection with client.
My config.xml on weblogic is:
<?xml version='1.0' encoding='UTF-8'?>
<domain xmlns="http://xmlns.oracle.com/weblogic/domain" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/domain http://xmlns.oracle.com/weblogic/1.0/domain.xsd http://xmlns.oracle.com/weblogic/security http://xmlns.oracle.com/weblogic/1.0/security.xsd http://xmlns.oracle.com/weblogic/security/wls http://xmlns.oracle.com/weblogic/security/wls/1.0/wls.xsd http://xmlns.oracle.com/weblogic/security/extension http://xmlns.oracle.com/weblogic/1.0/security.xsd">
<name>mydomain</name>
<domain-version>10.3.2.0</domain-version>
<security-configuration>
<name>mydomain</name>
<realm>
<sec:authentication-provider xmlns:ext="http://xmlns.oracle.com/weblogic/security/extension" xsi:type="ext:custom-authenticatorType">
<sec:name>CustomAuthenticator</sec:name>
<sec:control-flag>SUFFICIENT</sec:control-flag>
<ext:host>66.66.66.66</ext:host>
<ext:port>389</ext:port>
<ext:principal>some_principals_censored</ext:principal>
<ext:results-time-limit>2000</ext:results-time-limit>
<ext:connect-timeout>2990</ext:connect-timeout>
<ext:connection-retry-limit>100</ext:connection-retry-limit>
<ext:credential-encrypted>some_credentialss_censored</ext:credential-encrypted>
</sec:authentication-provider>
<sec:authentication-provider xsi:type="wls:default-authenticatorType"></sec:authentication-provider>
<sec:authentication-provider xsi:type="wls:default-identity-asserterType">
<sec:active-type>AuthenticatedUser</sec:active-type>
</sec:authentication-provider>
<sec:role-mapper xsi:type="wls:default-role-mapperType"></sec:role-mapper>
<sec:authorizer xsi:type="wls:default-authorizerType"></sec:authorizer>
<sec:adjudicator xsi:type="wls:default-adjudicatorType"></sec:adjudicator>
<sec:credential-mapper xsi:type="wls:default-credential-mapperType"></sec:credential-mapper>
<sec:cert-path-provider xsi:type="wls:web-logic-cert-path-providerType"></sec:cert-path-provider>
<sec:cert-path-builder>WebLogicCertPathProvider</sec:cert-path-builder>
<sec:user-lockout-manager></sec:user-lockout-manager>
<sec:deploy-role-ignored>false</sec:deploy-role-ignored>
<sec:deploy-policy-ignored>false</sec:deploy-policy-ignored>
<sec:security-dd-model>Advanced</sec:security-dd-model>
<sec:combined-role-mapping-enabled>false</sec:combined-role-mapping-enabled>
<sec:name>myrealm</sec:name>
</realm>
<default-realm>myrealm</default-realm>
<credential-encrypted>some_credetials</credential-encrypted>
<web-app-files-case-insensitive>os</web-app-files-case-insensitive>
<compatibility-connection-filters-enabled>true</compatibility-connection-filters-enabled>
<node-manager-username>weblogic</node-manager-username>
<node-manager-password-encrypted>encrypted_pass</node-manager-password-encrypted>
<enforce-strict-url-pattern>false</enforce-strict-url-pattern>
</security-configuration>
<security>
<name>mydomain</name>
<realm>wl_default_realm</realm>
<password-policy>wl_default_password_policy</password-policy>
</security>
<jta>
<name>mydomain</name>
<timeout-seconds>60000</timeout-seconds>
</jta>
<server>
<name>myserver</name>
<jms-thread-pool-size>0</jms-thread-pool-size>
<max-message-size>80000000</max-message-size>
<complete-message-timeout>480</complete-message-timeout>
<ssl>
<name>myserver</name>
<enabled>false</enabled>
<identity-and-trust-locations>KeyStores</identity-and-trust-locations>
</ssl>
<log>
<stdout-severity>Warning</stdout-severity>
</log>
<execute-queue>
<name>weblogic.kernel.Default</name>
<thread-count>100</thread-count>
</execute-queue>
<messaging-bridge-thread-pool-size>100</messaging-bridge-thread-pool-size>
<listen-port>7001</listen-port>
<listen-address>127.0.0.1</listen-address>
<xml-registry xsi:nil="true"></xml-registry>
<xml-entity-cache xsi:nil="true"></xml-entity-cache>
<extra-ejbc-options>-Xmx1g</extra-ejbc-options>
<tunneling-enabled>false</tunneling-enabled>
<staging-mode>stage</staging-mode>
<server-diagnostic-config>
<wldf-diagnostic-volume>High</wldf-diagnostic-volume>
</server-diagnostic-config>
<transaction-log-jdbc-store>
<enabled>false</enabled>
</transaction-log-jdbc-store>
<data-source>
<rmi-jdbc-security xsi:nil="true"></rmi-jdbc-security>
</data-source>
</server>
<embedded-ldap>
<name>mydomain</name>
<credential-encrypted>some_credentials</credential-encrypted>
</embedded-ldap>
<configuration-version>10.3.2.0</configuration-version>
<app-deployment>
<name>_appsdir_appear</name>
<module-type>ear</module-type>
<source-path>autodeploy\app.ear</source-path>
<sub-deployment>
....Some Ejb libs
</sub-deployment>
<deployment-order>100</deployment-order>
<security-dd-model>Advanced</security-dd-model>
<staging-mode>stage</staging-mode>
<cache-in-app-directory>false</cache-in-app-directory>
</app-deployment>
<ws-reliable-delivery-policy>
<name>RMDefaultPolicy</name>
<jms-server>WSStoreForwardInternalJMSServermyserver</jms-server>
<default-retry-count>10</default-retry-count>
<default-time-to-live>60000</default-time-to-live>
</ws-reliable-delivery-policy>
<file-realm>
<name>wl_default_file_realm</name>
</file-realm>
<realm>
<name>wl_default_realm</name>
<file-realm>wl_default_file_realm</file-realm>
</realm>
<password-policy>
<name>wl_default_password_policy</name>
</password-policy>
<jms-server>
<name>WSStoreForwardInternalJMSServermyserver</name>
<target>myserver</target>
<persistent-store>FileStore</persistent-store>
<allows-persistent-downgrade>true</allows-persistent-downgrade>
<hosting-temporary-destinations>false</hosting-temporary-destinations>
</jms-server>
<jms-server>
<name>MyJMS Server</name>
<target>myserver</target>
<store-enabled>false</store-enabled>
<allows-persistent-downgrade>true</allows-persistent-downgrade>
<hosting-temporary-destinations>false</hosting-temporary-destinations>
</jms-server>
<web-app-container>
<relogin-enabled>true</relogin-enabled>
<allow-all-roles>true</allow-all-roles>
<filter-dispatched-requests-enabled>true</filter-dispatched-requests-enabled>
<rtexprvalue-jsp-param-name>true</rtexprvalue-jsp-param-name>
<jsp-compiler-backwards-compatible>true</jsp-compiler-backwards-compatible>
</web-app-container>
<startup-class>
<name>StartupSerwerCustom</name>
<target>myserver</target>
<deployment-order>1</deployment-order>
<class-name>pl.com...</class-name>
<load-before-app-deployments>true</load-before-app-deployments>
</startup-class>
<startup-class>
...other startupclasses
</startup-class>
<file-store>
<name>FileStore</name>
<directory>rmfilestore</directory>
<synchronous-write-policy>Direct-Write</synchronous-write-policy>
<target>myserver</target>
</file-store>
<jms-interop-module>
<name>interop-jms</name>
<sub-deployment>
<name>CustomConnectionFactory</name>
<target>myserver</target>
</sub-deployment>
<sub-deployment>
<name>WSStoreForwardInternalJMSServermyserver</name>
<target>WSStoreForwardInternalJMSServermyserver</target>
</sub-deployment>
<sub-deployment>
<name>MyJMS Server</name>
<target>MyJMS Server</target>
</sub-deployment>
<descriptor-file-name>jms/interop-jms.xml</descriptor-file-name>
</jms-interop-module>
<admin-server-name>myserver</admin-server-name>
<jdbc-system-resource>
<name>DS_Server</name>
<target>myserver</target>
<descriptor-file-name>jdbc/DS_Server-jdbc.xml</descriptor-file-name>
</jdbc-system-resource>
</domain>
I've censored it a little :).
I would appreciate for some help with it.
FIXED:
I've added debug options on Weblogic:
-Dweblogic.kernel.debug=true
-Dweblogic.debug.DebugConnection=true
-Dweblogic.StdoutDebugEnabled=true
-Dweblogic.log.LogSeverity=Debug
-Dweblogic.log.LoggerSeverity=Debug
One of jar file had wrong path. So it thrown "ClassNotFoundException". Debuging allowed me to find it... Simple mistakes are most annoying ones ;).
I have simple-as-can-be Web Start application sitting on a file server. The directory consists of the following:
foo__V1.1.jar
runfoo.jnlp
The contents of runfoo.jnlp is as follows:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" href="http://myserver.com/runfoo.jnlp" codebase="http://myserver.com">
<information>
<title>Foo</title>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.7.0_06+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="foo.jar" main="true" version="1.0+"/>
<property name="jnlp.versionEnabled" value="true"/>
</resources>
<application-desc name="Foo" main-class="com.myserver.foo.Foo" width="640" height="480" />
<update check="always" policy="always" />
</jnlp>
The issue is that Web Start is attempting to access a file at http://myserver.com/runfoo.jnlp?version-id=1.0%2B, and not finding it.
I assume there's some extra step required to have Web Start automatically grab the latest jar version in this simple instance, but after a lot of Googling all I've found is the same steps over and over:
rename file to <file_name>__V<versionnumber>.jar
Add the versionEnabled property to the jnlp
enjoy versioned goodness
The jnlp file runs absolutely fine when I specify an explicit file name, but always fails when I've tried to implement versioning.
I'm sure I'm missing something vital but I haven't been able to find it anywhere. I'm guessing that although my set-up is simple, it's not simple-as-can-be-and-also-work.
Any help will be much appreciated :)
The explicit exception is:
com.sun.deploy.net.FailedDownloadException: Unable to load resource: (http://myserver.com/foo.jar?version-id=1.0%2B, 1.0+)
I've also tried removing the + from the version specification and the same error occurs (apart from a missing plus of course). Writting foo__V1.1.jar in the jnlp file works but of course defeats the whole point of this.
The versioned file names are a convention used by the JNLP download servlet to know what to serve when the client asks for lib.jar?version=something. You need the download servlet on the server side (or you need to duplicate its behaviour in mod_rewrite rules or similar), just the plain files with versions names is not enough.
For followers, a similar issue for me
java.io.IOException: Error returned: 10 Could not locate resource
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.downloadResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
"unable to launch application"
com.sun.deploy.net.FailedDownloadException: Unable to load resource: (http://host:port/webapp_name/app/jar-name.jar?version-id=1.5.0-20160707.182810-19, 1.5.0-20160707.182810-19)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.downloadResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
meant "the special internal file version.xml didn't match up right with the filenames deployed and existent in the web-app directory":
ref: http://docs.oracle.com/javase/6/docs/technotes/guides/javaws/developersguide/downloadservletguide.html