This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

ClasscastException in jboss for JCA connection  RSS feed

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,



I am trying to migrate the JCA connector code developed for weblogic server to Jboss eap 6.0.1 , but i am getting following error in the jboss eap 6.0 console when i deployed the code after made some changes.



15:52:47,726 WARNING [com.tiscon.bpm.clusterbridge.BPMClusterBridgeBean] (Thread-171) Error while loadWorkItems for FC-SYSTEM-IPP: com.tiscon.bpm.connector.BPMException: com.tiscon.bpm.connector.staffware.ConnectionFactory cannot be cast to com.tiscon.bpm.connector.BPMConnectionFactory

at com.tiscon.bpm.connector.BPMConnectionFacadeBean.loadWorkItems(BPMConnectionFacadeBean.java:237)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_45]

at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_45]




####################################3

The ironjacamar.xml file is:

<?xml version="1.0" encoding="UTF-8"?>
<ironjacamar>

<connection-definitions>
<connection-definition class-name="com.tiscon.bpm.connector.staffware.ManagedConnectionFactoryImpl" jndi-name="java:/fec/StaffwareProcessSuite">
<pool>
<min-pool-size>0</min-pool-size>
<max-pool-size>10</max-pool-size>
</pool>
</connection-definition>
</connection-definitions>
</ironjacamar>

###################

The ra.xml file is:



<?xml version="1.0" encoding="UTF-8"?>

<connector xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd" version="1.5">



<description>Staffware Process Suite ResourceAdapter</description>

<display-name>Staffware Process Suite ResourceAdapter</display-name>

<vendor-name>tiscon</vendor-name>

<eis-type>JDBC 2 XA drivers</eis-type>

<resourceadapter-version>1.0</resourceadapter-version>

<resourceadapter>

<outbound-resourceadapter>

<connection-definition>

<managedconnectionfactory-class>com.tiscon.bpm.connector.staffware.ManagedConnectionFactoryImpl</managedconnectionfactory-class>

<config-property>

<config-property-name>AdminQueueJNDIName</config-property-name>

<config-property-type>java.lang.String</config-property-type>

<config-property-value>java:/queue/SurveyorAdminQueue</config-property-value>

</config-property>

<config-property>

<config-property-name>UserName</config-property-name>

<config-property-type>java.lang.String</config-property-type>

<config-property-value>fclaim</config-property-value>

</config-property>

<config-property>

<config-property-name>Password</config-property-name>

<config-property-type>java.lang.String</config-property-type>

<config-property-value>fclaimpwd</config-property-value>

</config-property>

<config-property>

<config-property-name>WatcherRefreshDelay</config-property-name>

<config-property-type>java.lang.Long</config-property-type>

<config-property-value>10000</config-property-value>

</config-property>

<config-property>

<config-property-name>StaffwareNodeName</config-property-name>

<config-property-type>java.lang.String</config-property-type>

<config-property-value>staff_isoit922</config-property-value>

</config-property>

<config-property>

<config-property-name>StaffwareServerName</config-property-name>

<config-property-type>java.lang.String</config-property-type>

<config-property-value>server.houston.com</config-property-value>

<!-- <config-property-value>abc.com</config-property-value> -->

</config-property>

<config-property>

<config-property-name>StaffwareServerIpAddress</config-property-name>

<config-property-type>java.lang.String</config-property-type>

<config-property-value>34.34.54.74</config-property-value>

</config-property>

<config-property>

<config-property-name>StaffwareServerTcpPort</config-property-name>

<config-property-type>java.lang.Integer</config-property-type>

<config-property-value>1502</config-property-value>

</config-property>

<connectionfactory-interface>com.tiscon.bpm.connector.BPMConnectionFactory</connectionfactory-interface>

<connectionfactory-impl-class>com.tiscon.bpm.connector.staffware.ConnectionFactory</connectionfactory-impl-class>

<connection-interface>com.tiscon.bpm.connector.BPMConnection</connection-interface>

<connection-impl-class>com.tiscon.bpm.connector.staffware.Connection</connection-impl-class>

</connection-definition>

<transaction-support>NoTransaction</transaction-support>



<reauthentication-support>false</reauthentication-support>

</outbound-resourceadapter>

</resourceadapter>

</connector>

Can anybody suggest why am i getting this error?



Regards

Sanjeev Kumar
 
Ranch Hand
Posts: 172
C++ Redhat Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't the cited exception the cast you made? IF it is, check out what is the Object that you get from JNDI (which if it is only this execption in the log, i would say that JCA is creating a proxy for another class/interface that you are not spectating but it will work fine without that cast). As it is a third party JCA, you need to find out with your vendor how to get a more fine grain log using that. Maybe enabling the trace log level in jboss can help if my assumption around the only problem is the cast is wrong.. I will post this message in your post in https://community.jboss.org/message/868901 just to reach you faster
 
sanjeev kumar mandal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Luan,


I am getting "com.tiscon.bpm.connector.staffware.ConnectionFactory" object from jndi instead of "BPMConnectionFactory" object and due to which i am getting

cast error.

If you see the ejb-jar.xml,i have pasted above has entry for resource type , which is "com.tiscon.bpm.connector.BPMConnectionFactory" ,but the jboss is

returning "com.tiscon.bpm.connector.staffware.ConnectionFactory" object. The class "com.tiscon.bpm.connector.staffware.ConnectionFactory" is implementing
"com.tiscon.bpm.connector.BPMConnectionFactory" interface.



The same code is running properly in weblogic server and the server is returning the "BPMConnectionFactory" object. This is the only exception i am getting

in the jboss log file.



If jboss is not able to return the "BPMConnectionFactory" object ,then how it is returning proxy of another class (i.e

com.tiscon.bpm.connector.staffware.ConnectionFactory).



The actual lookup code is mentioned below:



private BPMConnectionFactory connectionFactory;

Context context = new InitialContext();

connectionFactory = (BPMConnectionFactory) context.lookup("java:/fec/StaffwareProcessSuite");





Also i have tried with below code when i am getting the ConnectionFactory object using lookup



private ConnectionFactory connectionFactory;

Context context = new InitialContext();

connectionFactory = (ConnectionFactory) context.lookup("java:/fec/StaffwareProcessSuite");





The exception i am getting in jboss console for above lookup code is mentioned below.::



20:04:35,200 INFO [com.tiscon.bpm.connector.BPMConnectionFacadeBean] (http-127.0.0.1/127.0.0.1:8080-1) ::::::::========bpmConnection======== after lookup

com.tiscon.bpm.connector.staffware.ConnectionFactory@74a83c5d

20:04:35,202 ERROR [org.jboss.as.ejb3.invocation] (http-127.0.0.1/127.0.0.1:8080-1) JBAS014134: EJB Invocation failed on component BPMConnectionFacade for

method public abstract com.tiscon.bpm.connector.BPMWorkItem[] com.tiscon.bpm.connector.BPMConnectionFacade.loadWorkItems

(java.lang.String,java.lang.String,java.lang.String) throws

javax.resource.ResourceException,com.tiscon.bpm.connector.BPMConnectorException,com.tiscon.bpm.connector.BPMException,java.rmi.RemoteException:

javax.ejb.EJBException: javax.ejb.EJBException: java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation: when resolving method

"com.tiscon.bpm.connector.staffware.ConnectionFactory.getConnection(Ljava/lang/String;Ljava/lang/String;)Lcom/tiscon/bpm/connector/BPMConnection;" the class

loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, com/tiscon/bpm/connector/BPMConnectionFacadeBean, and the class loader

(instance of org/jboss/modules/ModuleClassLoader) for resolved class, com/tiscon/bpm/connector/staffware/ConnectionFactory, have different Class objects for

the type com/tiscon/bpm/connector/BPMConnection used in the signature

at org.jboss.as.ejb3.tx.CMTTxInterceptor.notSupported(CMTTxInterceptor.java:280) [jboss-as-ejb3-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-

4]

at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:186) [jboss-as-ejb3-7.1.3.Final-redhat-4.jar:7.1.3.Final-

redhat-4]

at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-

redhat-2]

at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:79)

[jboss-as-ejb3-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-

redhat-2]

at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation

(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-

redhat-2]

at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:42) [jboss-as-

ejb3-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-

redhat-2]

at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.3.Final-

redhat-4.jar:7.1.3.Final-redhat-4]

at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-

redhat-2]

at org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactories$1.processInvocation

(EjbExceptionTransformingInterceptorFactories.java:65) [jboss-as-ejb3-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-

redhat-2]

at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.3.Final-

redhat-4.jar:7.1.3.Final-redhat-4]

at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-

redhat-2]

at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-as-ejb3-

7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-

redhat-2]

at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-

redhat-4]

at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-

redhat-2]

at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-

2.jar:1.1.1.Final-redhat-2]

at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]

at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:221) [jboss-as-ejb3-7.1.3.Final-redhat-

4.jar:7.1.3.Final-redhat-4]

at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) [jboss-ejb-client-1.0.11.Final-redhat-

1.jar:1.0.11.Final-redhat-1]

at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:42) [jboss-ejb-client-1.0.11.Final-redhat-

1.jar:1.0.11.Final-redhat-1]

at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183) [jboss-ejb-client-1.0.11.Final-redhat-

1.jar:1.0.11.Final-redhat-1]

at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:125) [jboss-ejb-client-1.0.11.Final-redhat-

1.jar:1.0.11.Final-redhat-1]

at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183) [jboss-ejb-client-1.0.11.Final-redhat-

1.jar:1.0.11.Final-redhat-1]

at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) [jboss-ejb-client-1.0.11.Final-redhat-

1.jar:1.0.11.Final-redhat-1]

at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) [jboss-ejb-client-1.0.11.Final-redhat-

1.jar:1.0.11.Final-redhat-1]

at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) [jboss-ejb-client-1.0.11.Final-redhat-1.jar:1.0.11.Final-

redhat-1]

at com.sun.proxy.$Proxy37.loadWorkItems(Unknown Source)

at com.tiscon.bpm.clusterbridge.BPMClusterBridgeBean.loadWorkItems(BPMClusterBridgeBean.java:240)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_45]

at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_45]

at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation

(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.3.Final-redhat-4.jar:7.1.3.Final-redhat-4]




I have seen the log file , which contains only the cast exception which is caused by the jboss server returning the wrong object.
I am not able to find out any configuration mistake that i have made so that the jboss is returning wrong object or is there any class loading issue?

Already pasted ra.xml and ironjacamar.xml above.




Regards

Sanjeev Kumar Mandal.
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!