[Beginners Corner] - EJB 3 TrailBlazer Demo Class Cast
by pKraemer
Well I know that there are several Threads about the ClassCast Problem, but nothing helped me realy - except looking that I did not have these errors.
So, I use JBoss 4.04 and started with the TrailBlazer Demo about StatelessSessionBeans.
I can start the JSP but I got a ClassCastException during it.
I have deployed it to TrailBalzerApplication.ear which contains:
| TrailBlazerApplication.ear
| application.xml
| jboss-app.xml
| TrailBlazerEJB.jar
| TrailBlazerWeb.war
|
The application.xml:
| <application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
| <display-name>TrailBlazerApplication</display-name>
|
| <module id="myeclipse.1170763402122">
| <ejb>TrailBlazerEJB.jar</ejb>
| </module>
|
| <module id="myeclipse.1170763401891">
| <web>
| <web-uri>TrailBlazerWeb.war</web-uri>
| <context-root>TrailBlazerWeb</context-root>
| </web>
| </module>
| </application>
|
The jboss-app.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <jboss-app>
| <loader-repository>
| trailblazerOne:app=ejb3
| </loader-repository>
| </jboss-app>
|
The SessionBean
| package trail.slsb;
|
| import org.jboss.annotation.ejb.LocalBinding;
|
| import javax.ejb.*;
|
| @Stateless
| @LocalBinding (jndiBinding="EJB3TrailBlazer/slsb/Calculator")
| public class StatelessCalculator implements Calculator {
|
| public double calculate (int start, int end, double growthrate, double saving) {
| double tmp = Math.pow(1. + growthrate / 12., 12. * (end - start) + 1);
| return saving * 12. * (tmp - 1) / growthrate;
| }
|
| }
|
Part of the jsp:
| <%@ page import="trail.slsb.*, javax.naming.*, java.text.*"%>
|
| <%!
| private Calculator cal = null;
| public void jspInit () {
| try {
| InitialContext ctx = new InitialContext();
| cal = (Calculator) ctx.lookup(
| "EJB3Trail/StatelessCalculator/local");
| } catch (Exception e) {
| e.printStackTrace ();
| }
| }
| %>
|
There are no errors during deployment
Can anybody please help me?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011890#4011890
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011890
19Â years, 2Â months
[JBoss jBPM] - Re: State machine
by sanne
Hi Koen,
Thanks for your reply. The question was meant to be rhetorical!
No serious. A workflow is about process state. A state machine in its minimalist form is an object state. The state of the object is changed according to the type of event that occurs. Say the object is in state s1. On event e2 the object switches to s2, on e3 the object switches to s3, on e4 nothing happens, because this is not allowed.
Let me give an example. Say someone wants to update an order. This proces can involve a workflow: after the update of the order maybe financial approval needs to be asked. After an selectForUpdate request the invoice switches to the state selectForUpdate. No other event is allowed except the update event. If someone wants to ship the order: nope! Not now.
One could model the invoice state in the invoice object: but it doesn't really belong there.
Managing object state and process state is different. Both are required in order to implement a robust services system. For as far as I could see JBpm is not intended to manage object state.
Rgrds,
Sanne
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011889#4011889
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011889
19Â years, 2Â months