Issue Details (XML | Word | Printable)

Key: GLASSFISH-20637
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: phil.zampino
Reporter: biemond
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
glassfish

Java EE 7 CDI issues on GlassFish 4

Created: 16/Jun/13 07:06 PM   Updated: Thursday 07:52 PM
Component/s: cdi
Affects Version/s: 4.0_b89_RC5
Fix Version/s: None

Time Tracking:
Not Specified

Environment:

mac osx


Tags: 4_0_1-review cdi glassfish4 jsf2_2
Participants: biemond, Darious3, jjsnyder83 and phil.zampino


 Description  « Hide

Hi,

Got some CDI issues on the latest GlassFish version

First in JSF2.2 the flowDefinition of flows does not work , I needed to use the faces-config.xml and that works perfectly

my example
@Named("flow1")
public class Flow1 implements Serializable {

private static final long serialVersionUID = -1L;

@Produces @FlowDefinition
public Flow buildMyFlow(@FlowBuilderParameter FlowBuilder flowBuilder) { System.out.println("flowdef"); String flowId = "flow1"; flowBuilder.id("", flowId); flowBuilder.viewNode(flowId, "/flow1/" + flowId + ".xhtml").markAsStartNode(); return flowBuilder.getFlow(); }
}

Also in the websockets and do an inject of session bean and does not do anything , also listen to an CDI event inside does not work

@ServerEndpoint("/mywebsocket")
public class MyWebSocket implements Serializable {

@Inject
JmsSessionBean jmsBean;

public void onJMSMessage(@Observes @CDIJmsEvent Message msg) {
System.out.println("Got JMS Message at WebSocket!");
try {
for (Session s : sessions) { s.getBasicRemote().sendText("message from JMS: " + msg.getBody(String.class)); }
} catch (IOException | JMSException ex) { ex.printStackTrace(); }
}

Inside a managed bean Inject and the CDI events works perfectly



biemond added a comment - 17/Jun/13 05:48 PM

Hi,

here is my netbeans projects on glassfish 4 https://github.com/biemond/JavaEE7

I defined some JSF 2.2 flows in
https://github.com/biemond/JavaEE7/tree/master/WebApp7EE/WebApp7EE-war/web/flow1

When I add this flow definition in the faces-config.xml it works fine
https://github.com/biemond/JavaEE7/blob/master/WebApp7EE/WebApp7EE-war/web/WEB-INF/faces-config.xml

but when I try to do the same in this class with the help of CDI
@Produces @FlowDefinition
public Flow defineFlow(@FlowBuilderParameter FlowBuilder flowBuilder)
in java class
https://github.com/biemond/JavaEE7/blob/master/WebApp7EE/WebApp7EE-war/src/java/nl/amis/web/flow/Flow1.java

It does not do anything ( don't see any CDI error ) and the page /flow1.xhtml can not be found.

Thanks


jjsnyder83 added a comment - 17/Jun/13 03:37 PM

I believe the WebSocket issue is a duplicte of : https://java.net/jira/browse/GLASSFISH-20371.

For the JSF issue can you provide more information on what the expected results are?


Darious3 added a comment - 17/Jun/13 07:29 AM

Flow example with formatting:

@Named("flow1")
public class Flow1 implements Serializable {

    private static final long serialVersionUID = -1L;

    @Produces @FlowDefinition
    public Flow buildMyFlow(@FlowBuilderParameter FlowBuilder flowBuilder) { 
       
        String flowId = "flow1"; 
        flowBuilder.id("", flowId); 
        flowBuilder.viewNode(flowId, "/flow1/" + flowId + ".xhtml").markAsStartNode(); 

        return flowBuilder.getFlow();
    }
}

WebSocket with formatting

@ServerEndpoint("/mywebsocket")
public class MyWebSocket implements Serializable {

    @Inject
    JmsSessionBean jmsBean;

    public void onJMSMessage(@Observes @CDIJmsEvent Message msg) {
        try {
            for (Session session : sessions) {
                session.getBasicRemote().sendText("message from JMS: " + msg.getBody(String.class));
            }
        } catch (IOException | JMSException ex) {
            ex.printStackTrace();
        }
    }
}