Showing posts with label CDI. Show all posts
Showing posts with label CDI. Show all posts

03 February 2015

Social Coding Resolves JAX-RS and CDI Producer Problem

The inimitable Bruno Borges picked up tweet earlier today commenting on a problem using @Produces with non-CDI libraries with WebLogic Server 12.1.3.

The tweeter put his example up on a github repository to share - quite a nice example of using JAX-RS, CDI integration and of using Arquillian to verify it works correctly.  Ticked a couple of boxes for what I've been looking at lately

Forking his project to have a look at it locally:

https://github.com/buttso/weblogic-producers

Turns out that the issue was quite a simple and common one - a missing reference to the jax-rs:2.0 shared-library that is needed to use JAX-RS 2.0 on WebLogic Server 12.1.3.   Needs a weblogic.xml to reference that library.

I made the changes in a local branch and tested it again:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] producers .......................................... SUCCESS [  0.002 s]
[INFO] bean ............................................... SUCCESS [  0.686 s]
[INFO] web ................................................ SUCCESS [  7.795 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------


With the tests now passing, pushed the branch to my fork and sent Kuba a pull request to have a look at the changes I made:

https://github.com/buttso/weblogic-producers/tree/steve_work

I now just hope it works in his environment too :-)

The GitHub model is pretty magical really.

02 July 2012

JSF Managed Beans, @PostConstruct and CDI

In a similar vein to my last post, with this blog I'd like to try and raise the visibility of another bug that is being seen in a few different places, and for which there is already a patch available for it.

The basic issue here is that when an application is using JSF Managed Beans that in turn make use of the @PostContruct lifecycle annotation to execute some post-construction tasks, if the WEB-INF/beans.xml file is included and thus enables the CDI circuitry, the @PostConstruct method on the JSF ManagedBean is no longer invoked.

The good news is that if this scenario is part of your application design, then you can pick up and apply a patch for WLS 12c that will resolve the issue.

The relevant base bug # is 13703600 and the Smart Update patch ID is UXPH.  

From what I've read in the bug logs, we're also looking to include this fix in one of the patch-set-updates (PSUs) we are providing, so anyone that applies the relevant PSU should automatically get this fix.