java.io.EOFException at weblogic - java

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 ;).

Related

From jboss/java1.6 to wildfly20/java1.8

sorry for long post
i have a web application made in java 1.6.0, jsf, richfaces3.3.3 and hibernate 3 ( DB oracle )
hibernate mapping made through *.hbm.xml files, and datasource configured on hibernate-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.hibernate.jmx.Hibernate"
name="jboss.har:service=HibernateFlowManager">
<!-- Datasource settings -->
<attribute name="SessionFactoryName">java:/hibernate/HibernateFlowManagerFactory</attribute>
<attribute name="DatasourceName">java:OracleDS</attribute>
<attribute name="Dialect">org.hibernate.dialect.Oracle9iDialect</attribute>
<!-- Second-level caching -->
<attribute name="SecondLevelCacheEnabled">false</attribute>
<attribute name="QueryCacheEnabled">false</attribute>
<attribute name="ReflectionOptimizationEnabled">true</attribute>
<!-- Batching -->
<attribute name="JdbcBatchSize">50</attribute>
<!-- Logging -->
<attribute name="ShowSqlEnabled">false</attribute>
</mbean>
</server>
i have an HibernateUtils class with sessionFactory
sessionFactory = (SessionFactory)new InitialContext().lookup("java:/hibernate/HibernateFlowManagerFactory");
all packed in app.ear and deployed into jboss 4.2.3.GA
the goal is use the app with java 1.8.0 and use wildfly 20
i installed wildfly 20 and configured a oracle datasource OracleDS and test is ok
i tried to deploy app.ear but i have the exception
20:26:18,094 ERROR [org.jboss.as.server] (management-handler-thread Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class myapp.appl.beans.MgrValidatorBean with ClassLoader ModuleClassLoader for Module \"deployment.app.ear.app.jar\" from Service Module Loader
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Query
Caused by: java.lang.ClassNotFoundException: org.hibernate.Query from [Module \"deployment.app.ear.app.jar\" from Service Module Loader]",
"jboss.deployment.subunit.\"app.ear\".\"app.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"app.war\" of deployment \"app.ear\"
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session
i don't want to change hibernate in the app so i builded app.ear and in META-INF folder i put file jboss-deployment-structure.xml like this
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
<!-- This is the top level ear module, which contains all the classes in the EAR's lib folder -->
<deployment>
<!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->
<!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->
<exclude-subsystems>
<subsystem name="org.hibernate" />
<subsystem name="org.hibernate.validator" />
</exclude-subsystems>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.hibernate" />
<module name="org.hibernate.validator" />
</exclusions>
</deployment>
</jboss-deployment-structure>
deploy and different exception
20:29:20,671 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("deploy") failed - address: ({"deployment" => "app.ear"}) - failure description: {
"WFLYCTL0080: Failed services" => {
"jboss.deployment.subunit.\"app.ear\".\"app.jar\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"app.jar\" of deployment \"app.ear\"
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class myapp.appl.beans.MgrValidatorBean with ClassLoader ModuleClassLoader for Module \"deployment.app.ear.app.jar\" from Service Module Loader
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Query
Caused by: java.lang.ClassNotFoundException: org.hibernate.Query from [Module \"deployment.app.ear.app.jar\" from Service Module Loader]",
what approach i can use to achieve my goal ?

How to resolve error with Spring process looking for EJB JNDI endpoint?

I have an Apache Camel Spring process that connects to a JBoss 4.2.3 app server to get EJB remote proxies.
The following is the XML snippet of the configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd"
default-lazy-init="true">
<!-- ================================ -->
<!-- EJB Components -->
<!-- ================================ -->
<jee:remote-slsb id="brokingReferenceService"
jndi-name="BrokingReferenceServiceBean/remote"
business-interface="com.company.command.ejb.BrokingReferenceService"/>
<jee:remote-slsb id="strategyReferenceService"
jndi-name="StrategyReferenceServiceBean/remote"
business-interface="com.company.command.ejb.StrategyReferenceService"/>
<jee:remote-slsb id="instantMessageOrderService"
jndi-name="InstantMessageOrderServiceBean/remote"
business-interface="com.company.command.ejb.InstantMessageOrderService"/>
...
</beans>
I have a jndi.properties file in the classpath, which contains the following:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=http://10.10.0.240:1100
But I am receiving the following error when the process attempts to lookup the JNDI endpoint:
2017-01-03 09:15:07.057 DEBUG (org.springframework.jndi.JndiTemplate) Looking up JNDI object with name [java:comp/env/BrokingReferenceServiceBean/remote]
2017-01-03 09:15:09.322 DEBUG (org.jnp.interfaces.NamingContext) Failed to connect to http:1099
javax.naming.CommunicationException: Failed to connect to server http:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.UnknownHostException: http]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:274)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.lookup(AbstractRemoteSlsbInvokerInterceptor.java:100)
at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.refreshHome(AbstractSlsbInvokerInterceptor.java:122)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.refreshHome(SimpleRemoteSlsbInvokerInterceptor.java:163)
at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.afterPropertiesSet(AbstractSlsbInvokerInterceptor.java:109)
...
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.U
nknownHostException: http]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:248)
... 48 more
Caused by: java.net.UnknownHostException: http
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at java.net.InetAddress.getByName(InetAddress.java:1076)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:76)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:244)
... 48 more
Does anyone have an idea why it is not picking up the URL properly? I have defined the URL in the properties file, but it is parsing the URL as "http:1099".
Thanks for your help.
Try those things:
java.naming.provider.url=jnp://10.10.0.240:1100
java.naming.provider.url=10.10.0.240:1100
See the documentation here

Configuring log4jdbc-log4j2 with Liberty Profile

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.

java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map; when deploying jersey ws to Weblogic

I'm deploying a web service application on Weblogic 12. The application uses jersey and thus depends on javax.ws.rs-api:2.0.1 library.
However when I deploy it to server I have a following error :
Caused By: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:304)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:285)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:337)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:288)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
...
I think that weblogic might have it's own version of javax.ws.rs.core.Application that doesn't have this getProperties() method. I'm packaging the application in a WAR file and tried to use
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
in weblogic.xml, to explicitly tell Weblogic to use 2.0.1 version of this library.
Nothing helped so far, the issue still in place..
Thanks.
I found this to work as a solution. Add it in your weblogic.xml:
<wls:container-descriptor>
<wls:prefer-application-packages>
<!-- jersey-bundle-*.jar-->
<wls:package-name>com.sun.jersey.*</wls:package-name>
<wls:package-name>com.sun.research.ws.wadl.*</wls:package-name>
<wls:package-name>com.sun.ws.rs.ext.*</wls:package-name>
<!-- Jackson-*.jar -->
<wls:package-name>org.codehaus.jackson.*</wls:package-name>
<!-- jettison-*.jar -->
<wls:package-name>org.codehaus.jettison.*</wls:package-name>
<!-- jsr311*.jar -->
<wls:package-name>javax.ws.rs.*</wls:package-name>
<!-- asm.jar -->
<wls:package-name>org.objectweb.asm.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
Reference from Oracle Weblogic Documenation

Liferay portlet deployment - class cast exception

I am new to portlets and I am trying to build one from my JSF 2.0 app. I am using liferay-portal-tomcat-6.1.0-ce-b4, JSF 2.1.3 and PortletFaces bridge 2.0.1.
When I try to install the portlet into liferay, I allways get the following exception and I really dont know why, because according to the documentation, the org.portletfaces.bridge.GenericFacesPortlet shoult implement portlet interface...
09:31:31,709 ERROR [HotDeployUtil:114]
com.liferay.portal.kernel.deploy.hot.HotD eployException: Error
registering portlets for MondisVisualizer-1.3-SNAPSHOT
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error
registering portl ets for MondisVisualizer-1.3-SNAPSHOT
at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDe
ployException(BaseHotDeployListener.java:46)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(P
ortletHotDeployListener.java:117)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent
(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(H
otDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(Ho
tDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit
(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePor
talLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLif
ecycleUtil.java:61)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLif
ecycleUtil.java:53)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLife
cycle(BasePortalLifecycle.java:50)
at com.liferay.portal.kernel.servlet.PortletContextListener.contextIniti
alized(PortletContextListener.java:55)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:
5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:
5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.ClassCastException: org.portletfaces.bridge.GenericFacesPor
tlet cannot be cast to javax.portlet.Portlet
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:1
31)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(Po
rtletHotDeployListener.java:603)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy
(PortletHotDeployListener.java:385)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(P
ortletHotDeployListener.java:114)
... 17 more
portlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<portlet-name>Visualizer</portlet-name>
<portlet-class>org.portletfaces.bridge.GenericFacesPortlet</portlet-class>
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/index.xhtml</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<portlet-info>
<title>Mondis Visualizer</title>
</portlet-info>
</portlet>
</portlet-app>
liferay-portlet.xml:
<liferay-portlet-app>
<portlet>
<portlet-name>Visualizer</portlet-name>
<instanceable>true</instanceable>
<remoteable>false</remoteable>
<ajaxable>false</ajaxable>
<!-- <header-portlet-css>/resources/styles/bookCatalog.css</header-portlet-css>
<header-portlet-javascript>/resources/scripts/jsf.js</header-portlet-javascript> -->
</portlet>
</liferay-portlet-app>
liferay-display.xml:
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.0.0//EN" "http://www.liferay.com/dtd/liferay-display_6_0_0.dtd">
<display>
<category name="category.mondis.visualizer">
<portlet id="Visualizer" />
</category>
</display>
Thanks in advance.
I have found the issue, which kills my portlet.
The porlet.jar of the bundled liferay is probably somehow hacked/modified. The workaround is to set portlet.jar dependency as "provided" in maven - and java will link your code at run-time to the (probably modified) library in tomcat. And it will work...
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
Go to
liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps
There you will find the file which you are trying to deploy,
Also:
D ...... \liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\temp
Temp will create a folder of what you have deployed in the deployed folder. I suggest to delete all the content in temp and restart your server.

Categories