[GLASSFISH-20637] Java EE 7 CDI issues on GlassFish 4 Created: 16/Jun/13  Updated: 03/Jun/14

Status: Open
Project: glassfish
Component/s: cdi
Affects Version/s: 4.0_b89_RC5
Fix Version/s: None

Type: Bug Priority: Major
Reporter: biemond Assignee: phil.zampino
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mac osx


Tags: 4_0_1-approved, cdi, glassfish4, jsf2_2

 Description   

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



 Comments   
Comment by Darious3 [ 17/Jun/13 ]

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();
        }
    }
}
Comment by jjsnyder83 [ 17/Jun/13 ]

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?

Comment by biemond [ 17/Jun/13 ]

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

Generated at Mon Mar 30 08:09:21 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.