[EJB/JBoss] - Class.cast.Exception when Accessing a Session bean on 4.0.5
by ncheetham
Can anyone help me - I'm at a loss. I'm also embarrassed because I think this should be easy. I've deployed my application in an EAR, it contains a JSF web app, and some EJB's.
Here's the code I use to call the bean.
| InitialContext context = new InitialContext();
|
| Object objref = context.lookup("ReservationManager");
|
| ReservationManagerHome reservationManagerHome =
| (ReservationManagerHome)PortableRemoteObject.narrow(objref, ReservationManagerHome.class);
|
| _reservationManager =
| (ReservationManager)reservationManagerHome.create();
|
The context.lookup successfully returns a proxy, but the narrow function throws a Class Cast Error shown below:
2006-12-07 14:56:13,610 ERROR [businesstier.base.ReservationsClassFactory] java.lang.ClassCastException
|
The deployment reports no errors -> here's the log:
| DEBUG [org.jboss.ejb.EJBDeployer.verifier] Bean checked: ReservationManager: Verified.
| ...
| INFO [org.jboss.ejb.EjbModule] Deploying ReservationManager
| ...
| DEBUG [org.jboss.ejb.EjbModule] creating binding for ReservationManager:stateless-rmi-invoker
| ...
| DEBUG [org.jboss.system.ServiceController] Creating service jboss.j2ee:jndiName=ReservationManager,service=EJB
| ...
| DEBUG [org.jboss.ejb.StatelessSessionContainer] Creating jboss.j2ee:jndiName=ReservationManager,service=EJB
| ...
| DEBUG [org.jboss.system.ServiceController] Creating service jboss.j2ee:service=EJB,plugin=pool,jndiName=ReservationManager
| DEBUG [org.jboss.ejb.plugins.StatelessSessionInstancePool] Creating jboss.j2ee:service=EJB,plugin=pool,jndiName=ReservationManager
| ...
| DEBUG [org.jboss.ejb.plugins.StatelessSessionInstancePool] Created jboss.j2ee:service=EJB,plugin=pool,jndiName=ReservationManager
| ...
| jboss.j2ee:jndiName=ReservationManager,service=EJB state: Created
| ...
| INFO [org.jboss.ejb.plugins.local.BaseLocalProxyFactory] Bound EJB LocalHome 'ReservationManager' to jndi 'local/ReservationManager@15468898'
|
I can see it as a service in the JMX-Console
The Web.XML looks like this:
| <ejb-ref>
| <ejb-ref-name>ejb/ReservationManager</ejb-ref-name>
| <ejb-ref-type>Session</ejb-ref-type>
| <home>businesstier.impl.ReservationManagerHome</home>
| <remote>businesstier.impl.ReservationManager</remote>
| <ejb-link>ReservationManager</ejb-link>
| </ejb-ref>
|
The ejb-jar.xml looks like this:
| <session>
| <description>Session Bean ( Stateless )</description>
| <display-name>ReservationManager</display-name>
| <ejb-name>ReservationManager</ejb-name>
| <home>businesstier.impl.ReservationManagerHome</home>
| <remote>businesstier.impl.ReservationManager</remote>
| <local-home>businesstier.impl.ReservationManagerLocalHome</local-home>
| <local>businesstier.impl.ReservationManagerLocal</local>
| <ejb-class>businesstier.impl.ReservationManagerBean</ejb-class>
| <session-type>Stateless</session-type>
| <transaction-type>Container</transaction-type>
| ...
|
The deployment works like a charm on Oracle Application Server 10g.
I'm completely stumped. What am I missing.
Thanks,
Nigel
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992069#3992069
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992069
19 years, 4 months
[JBoss jBPM] - Decision Node Problems
by highlnd
I'm trying to test out a simple decision node. So I have the XML as this:
[decision name="Date Less Than Two Weeks"]
[handler class="com.baerresengroup.bpm.SaleDateDecision"/]
[transition name="Yes" to="Approve Order Form"][/transition]
[transition name="No" to="Approve Purchase Order"][/transition]
[/decision]
And for my handler class I have this:
public class SaleDateDecision implements DecisionHandler {
public String decide(ExecutionContext executionContext) throws Exception {
return "No";
}
}
It just goes to the No transition for testing purposes. However, when the token gets to the decision node in the process using the test web app I get the exception below. Can anyone shed some light on this problem? Thanks!
javax.faces.FacesException: Error calling action method of component with id taskform:transitionButton
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
javax.faces.component.UICommand.broadcast(UICommand.java:106)
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:271)
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:94)
org.jbpm.webapp.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:55)
org.jbpm.web.JbpmContextFilter.doFilter(JbpmContextFilter.java:83)
org.jbpm.webapp.filter.LogFilter.doFilter(LogFilter.java:59)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992062#3992062
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992062
19 years, 4 months
[JBoss jBPM] - Application Descriptor: WS invokation with unknow name from
by bertrand.njiipwo
Hello @all,
i'm facing the following problem:
I'm trying to call a web service from a well know category (schufa, travelAgency f.e.) but at calling time the name of the web service is unknow (see. Background infos).
My problem: At the design time i don't know the name of the WS which will be invoke. Therefore i can't not specify the name of that WS but only the cathegory name in the URL "http://somemachine:8089/context/services/travelAgency".
If i specify for example in {JBPM.BPEL.EXAMPLE}/hello/web/wsdl/bpel-application.xml following:
<partnerLink name="Approving">
| <partnerRole>
| <wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
| <wsa:Address>USE_ACTUAL_URI_FROM_CATALOG</wsa:Address>
| <wsa:ServiceName xmlns:travelAgency="urn:samples:travelAgency">travelAgency:TravelAgencyService</wsa:ServiceName>
| </wsa:EndpointReference>
| </partnerRole>
| </partnerLink>
| </partnerLinks>
| <serviceCatalogs>
| <urlCatalog contextUrl="http://localhost:8080/">
| <!-- published WSDL document of the remote service -->
| <wsdl location="context/services/travelAgency"/>
| </urlCatalog>
| </serviceCatalogs>
|
For the concret case where a WS with name TravelAgencyA is the best one the config will look like:
<serviceCatalogs>
| <urlCatalog contextUrl="http://localhost:8080/">
| <!-- published WSDL document of the remote service -->
| <wsdl location="context/service/travelAgencyA?wsdl"/>
| </urlCatalog>
| </serviceCatalogs>
Q: If is use did i explicitly need to incorporate the SOAPMessage in the HTTP-Request in the code or it's done automaticaly before the web service call?
the HTTP-Request is routed and received by the performance module but didn't contain the parameters in the SOAPMessage before the ws call.
For Background:
The problem is that at the time clients (BPEL-process) make a WS call they know only the name of the category (schufa, travelAgency). Some perfomance module will call the best service when the request is receive.
For this purpose clients just need to specify in their HTTP-request the name of the category: ("http://localhost:8089/context/travelAgency") they request. Service provider register web services under that category an the choise of which WS to invoke is token on the fly.
So my problem is that i know only the WSDL-Description of services in that named cathegory (All WSs in that category implement the same interface).
schufa.wsdl<?xml version="1.0" encoding="UTF-8"?>
| <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:samples:schufa" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" targetNamespace="urn:samples:schufa" name="SchufaService">
| <message name="validCustomerRequest">
| <part name="_surname" type="xsd:string"/>
| <part name="_firstname" type="xsd:string"/>
| </message>
| <message name="validCustomerResponse">
| <part name="validCustomerReturn" type="xsd:string"/>
| </message>
| <portType name="SchufaWS">
| <operation name="validCustomer" parameterOrder="_surname _firstname">
| <input name="validCustomerRequest" message="tns:validCustomerRequest"/>
| <output name="validCustomerResponse" message="tns:validCustomerResponse"/>
| </operation>
| </portType>
| </definitions>
|
schufa.impl.wsdl
| <?xml version="1.0" encoding="UTF-8"?>
| <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:samples:schufa" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="urn:samples:schufa" xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
| http://schemas.xmlsoap.org/wsdl/">
| <import namespace="urn:samples:schufa" location="schufa.wsdl"/>
| <binding name="SchufaSOAPBinding" type="tns:SchufaWS">
| <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
| <operation name="validCustomer">
| <soap:operation soapAction="urn:samples:schufa:validCustomer"/>
| <input>
| <soap:body use="literal" namespace="urn:samples:schufa"/>
| </input>
| <output>
| <soap:body use="literal" namespace="urn:samples:schufa"/>
| </output>
| </operation>
| </binding>
| <service name="SchufaService">
| <port name="schufaPort" binding="tns:SchufaSOAPBinding">
| <soap:address location="REPLACE_WITH_ACTUAL_URI"/>
| </port>
| </service>
| </definitions>
|
Process interface <?xml version="1.0" encoding="UTF-8"?>
| <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:samples:loanapproval" xmlns:loanapproval="urn:samples:loanapproval" xmlns:schufa="urn:samples:schufa" xmlns:types="urn:samples:loanapprovalTypes" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" targetNamespace="urn:samples:loanapproval">
| <import namespace="urn:samples:schufa" location="interface/schufa.wsdl"/>
| <types>
| <schema targetNamespace="urn:samples:loanapprovalTypes" xmlns="http://www.w3.org/2001/XMLSchema">
| <element name="loanProcessFault" type="types:loanProcessFaultType"/>
| <complexType name="loanApplicationType">
| <sequence>
| <element name="firstName" type="string"/>
| <element name="lastName" type="string"/>
| <element name="amount" type="float"/>
| </sequence>
| </complexType>
| <complexType name="approvalDecisionType">
| <sequence>
| <!--element name="approved" type="boolean"/-->
| <element name="approved" type="string"/>
| </sequence>
| </complexType>
| <complexType name="loanProcessFaultType">
| <sequence>
| <element name="ErrorCode" type="int"/>
| <element name="ErrorMessage" type="string"/>
| </sequence>
| </complexType>
| </schema>
| </types>
| <message name="applyRequest">
| <part name="loanRequestParameters" type="types:loanApplicationType"/>
| </message>
| <message name="applyResponse">
| <part name="loanResponse" type="types:approvalDecisionType"/>
| </message>
| <message name="applyLoanProcessFault">
| <part name="loanFault" element="types:loanProcessFault"/>
| </message>
| <portType name="LoanProcessPortType">
| <operation name="apply">
| <input message="tns:applyRequest"/>
| <output message="tns:applyResponse"/>
| <fault name="LoanProcessFault" message="tns:applyLoanProcessFault"/>
| </operation>
| </portType>
| <!-- Describe the relation between the -->
| <plt:partnerLinkType name="LoanProcessingPLT">
| <plt:role name="lender">
| <plt:portType name="tns:LoanProcessPortType"/>
| </plt:role>
| </plt:partnerLinkType>
| <!-- Describe the relation between the -->
| <plt:partnerLinkType name="SchufaPLT">
| <plt:role name="schufa">
| <plt:portType name="schufa:SchufaWS"/>
| </plt:role>
| </plt:partnerLinkType>
| </definitions>
BPEL Process:
<process name="loanapproval" suppressJoinFailure="yes" targetNamespace="urn:samples:loanapproval" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:tns="urn:samples:loanapproval" xmlns:loanapproval="urn:samples:loanapproval" xmlns:schufa="urn:samples:schufa" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2003/03/business-process/
| http://schemas.xmlsoap.org/ws/2003/03/business-process/">
| <partnerLinks>
| <partnerLink name="LoanProcessing" partnerLinkType="loanapproval:LoanProcessingPLT" myRole="lender"/>
| <partnerLink name="SchufaLink" partnerLinkType="tns:SchufaPLT" partnerRole="schufa"/>
| </partnerLinks>
| <variables>
| <variable name="applyRequest" messageType="loanapproval:applyRequest"/>
| <variable name="applyResponse" messageType="loanapproval:applyResponse"/>
| <variable name="schufaRequest" messageType="schufa:validCustomerRequest"/>
| <variable name="schufaResponse" messageType="schufa:validCustomerResponse"/>
| </variables>
| <sequence>
| <receive createInstance="yes" name="LoanApplication" operation="apply" partnerLink="LoanProcessing" portType="loanapproval:LoanProcessPortType" variable="applyRequest"/>
| <assign name="AssignLoanInfo_forApproval">
| <copy>
| <from variable="applyRequest" query="/loanRequestParameters/lastName" part="loanRequestParameters"/>
| <to variable="schufaRequest" part="_surname"/>
| </copy>
| <copy>
| <from variable="applyRequest" query="/loanRequestParameters/firstName" part="loanRequestParameters"/>
| <to variable="schufaRequest" part="_firstname"/>
| </copy>
| </assign>
| <invoke inputVariable="schufaRequest" name="SchufaCheck" operation="validCustomer" outputVariable="schufaResponse" partnerLink="SchufaLink" portType="schufa:SchufaWS"/>
| <assign name="AssignSchufaDecision">
| <copy>
| <from variable="schufaResponse" part="validCustomerReturn"/>
| <to variable="applyResponse" query="/loanResponse/approved" part="loanResponse"/>
| </copy>
| </assign>
| <reply name="ApprovalDecision" operation="apply" partnerLink="LoanProcessing" portType="loanapproval:LoanProcessPortType" variable="applyResponse"/>
| </sequence>
| </process>
|
|
I'm runnig with the configuration: JBoss AS 4.0.4.GA, jbpm.bpel1-beta1, jbpm-3.1. java 1.5.06, jwsdp-1.6, ant-1.6.5
Any suggestion howto configure my bpel-application descriptor (bpel-application.xml)? Any advice will help a lot.
Thanks in advance.
Bertrand
My
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992058#3992058
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992058
19 years, 4 months