Quantcast
Channel: zeroturnaround.com » All Posts
Viewing all articles
Browse latest Browse all 2540

JRebel fails to instantiate a new @ManagedProperty bean

$
0
0

Good morning,

I’m developing a user interface with JSF 2.0 running on liferay 6.2.2 on JBoss EAP 6.3.0.GA (AS 7.4.0.Final-redhat-19), using Liferay Faces Bridge 3.2.5-ga6. I start liferay with:

@echo off
set REBEL_BASE=C:\Users\alfons\.jrebel
set REBEL_HOME=C:\development\jrebel-7.1.1-nosetup\jrebel\
set JAVA_OPTS=-agentpath:%REBEL_HOME%\lib\jrebel64.dll -Xms1G -Xmx1G -XX:MaxPermSize=1024M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.modules.policy-permissions=true -Djboss.server.default.config=standalone.xml -Duser.timezone=UTC -Dfile.encoding=UTF-8 -Dexternal-properties=portal-developer.properties -Dorg.apache.el.parser.COERCE_TO_ZERO=false %JAVA_OPTS%
call “%~dp0\standalone.bat” %*

Then I add this managed property to my @ViewScoped bean called PersonEmploymentViewBean:

@ManagedProperty(value = “#{spainCompanyModelBean}”)
private SpainCompanyModelBean spainCompanyModelBean;

public SpainCompanyModelBean getSpainCompanyModelBean() {
return spainCompanyModelBean;
}

public void setSpainCompanyModelBean(SpainCompanyModelBean spainCompanyModelBean) {
this.spainCompanyModelBean = spainCompanyModelBean;
}

In SpainCompanyModelBean I create this method:

public String getHello() {
return “hola company”;
}

In PersonEmploymentViewBean I add a method which invokes that ManagedProperty:
public String getHelloFromCompany() {
return spainCompanyModelBean.getHello();
}

Then from the xhtml view I try to call it through PersonEmploymentViewBean:

<ui:define name=”ep-content-data”>

#{personEmploymentViewBean.helloFromCompany}
#{jeeManagedBean.hello}

What is working whithout redeploying (just compiling) nor restarting:
– It correctly finds PersonEmploymentViewBean and the method getHelloFromCompany.
– It correctly invokes spainCompanyModelBean.getHello(), BUT:

What is NOT working:

The spainCompanyModelBean is not automatically instantiated as it should be, it’s null. If I manually instantiate it in the @PostConstruct method it works but that instantiation has to be left to the container.

So in short, what is failing is that Jrebel does not trigger the instantiation of a new @ManagedProperty in another @ManagedBean.

Am I missing something? I tried to “touch” faces-config.xml file to see if that would trigger that instantiation but I didn’t get it to work, cause I read it that in the past that seemed to help.

I keep waiting for your answer, we are stuck on this for the frontend development, JRebel helps us a lot if we workaround this.


Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>