[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] Jetty 9.2.x - Annotations
|
Jan,
Thanks for the answer, I'll compare the project with the test-spec.war.
The @PostConstruct is declared as annotation on simple JSF-managed-beans.
Following two examples not working:
--------------------------------------------------------------------
| 1) simple managed bean which is declared in the "faces-config.xml" |
--------------------------------------------------------------------
<managed-bean>
<managed-bean-name>
treeController
</managed-bean-name>
<managed-bean-class>
myJarProject.control.impl.TreeController
</managed-bean-class>
<managed-bean-scope>
session
</managed-bean-scope>
</managed-bean>
This bean contains 2 methods:
-----------------------------
@PostConstruct
public void initController() {
}
public MyTree getTree(){
}
Executing the method:
---------------------
Only the "getTree" is called manually via "treeBB"-backing-bean
("this.treeController.getTree()") .
<h:outputText value="#{treeBB.tree}" escape="false" id="mainTree"/>
Comparison Jetty 9.1.5
------------------------
The initController-Method is correctly called in Jetty 9.1.5, but never
called in Jetty 9.2.x.
--------------------------------------------------------------------
| 2) eager-loading bean which is declared in the "faces-config.xml". |
--------------------------------------------------------------------
<managed-bean eager="true">
<managed-bean-name>
applicationModeController
</managed-bean-name>
<managed-bean-class>
myJarProject.appMode.ApplicationModeController
</managed-bean-class>
<managed-bean-scope>
application
</managed-bean-scope>
</managed-bean>
@PostConstruct
public void init() {
}
Executing the method:
---------------------
The bean should be created when the application starts (eager-loading)
and then the init-method should be processed.
In this init method there are some class member variables set, which are
read via static method after application-start, so the eager-loading is
necessary here.
Comparison Jetty 9.1.5
------------------------
The eager-loading doesn't work in Jetty (incl. 9.1.5), so I had to
implement a workaround in the getter-methods, to set the variables.
---
krumpi
On 28.09.2014 00:44, Jan Bartel wrote:
> Krumpi,
>
> Are the @PostConstruct methods on a servlet/filter/listener declared
> either in web.xml, a web-fragment.xml or an annotation, or
> programatically registered?
>
> Might be worth comparing your webapp to the test-spec.war in the
> demo-base of the distro, as that has some @PostConstruct methods on
> it.
>
> Jan
>
> On 27 September 2014 21:38, krumpi <krumpi@xxxxxx> wrote:
>> Hi,
>>
>> i've got an application running with many @PostConstruct-methods.
>>
>> The Application had been deployed on Jetty 9.1.5 without problems.
>> After upgrading to Jetty 9.2.2/9.2.3 the PostConstruct-methods aren't
>> executed any more (checked with debugger).
>> Although I've tried different installations, I couldn't get the
>> Application to work correctly.
>>
>> Details:
>> - jetty: jetty-distribution-9.2.3.v20140905 /
>> jetty-distribution-9.2.2.v20140723
>> - JSF 2.2 with myfaces 2.2.1/2.2.5
>> - web.xml: web-app set to 2.5/3.0/3.1
>> - jetty-plus/jetty-annotations is activated (checked with --list-modules
>> and --list-config)
>> - metadata-complete: false / not set
>> - The annotation-methods are in a jar-file in the webapp-directory.
>> - faces-config in jar-file: without / jsf 2.2 compatible "empty"
>> faces-config.
>>
>> Hope somebody could give me a hint what to try next.
>>
>>
>> Thanks in advance.
>> ---
>> krumpi
>> _______________________________________________
>> jetty-users mailing list
>> jetty-users@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
>