0

i have a normal dynamic web project with a Glassfish 3 server. I have a managed-bean that injects a stateless bean. With Mojarra 2.1.6 all works fine.

But when i add javax.faces-2.2.7.jar (Mojarra) to my Web-Inf lib folder and try to access to my site i get an Nullpointerexception for my "service".

The deploy and the new mojarra version is successful accepted.

EXCEPTION: java.lang.NullPointerException at bean.MyBean.init(MyBean.java:18)

Example Code:

Managed- Bean:

@ManagedBean
@ViewScoped
public class MyBean {
@EJB
private MyStatelessBean statelessBean;

private String hello;

@PostConstruct
public void init(){
    setHello(statelessBean.sayHello());
}

public String getHello() {
    return hello;
}

public void setHello(String hello) {
    this.hello = hello;
}
}

Stateless- Bean:

@Stateless
public class MyStatelessBean {

public String sayHello(){
    return "Hello";
}
}

XHTML:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>

</h:head>

<h:body>
<h:outputText value="#{myBean.hello}" />
</h:body>
</html>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
pL4Gu33
  • 2,045
  • 16
  • 38

1 Answers1

0

Solution was reset glassfish cache and all works fine ;)

pL4Gu33
  • 2,045
  • 16
  • 38