[weld-dev] Unique BeanIdentifierIndex every time I restart a server

Benjamin Confino BENJAMIC at uk.ibm.com
Fri Oct 21 11:55:06 EDT 2016


Thanks Martin. 

It looks like I have an integration defect to track down. 

Regards
Benjamin



From:   Martin Kouba <mkouba at redhat.com>
To:     Benjamin Confino/UK/IBM at IBMGB, weld-dev at lists.jboss.org, 
Cc:     Emily Jiang/UK/IBM at IBMGB, Steven Schader <schader at us.ibm.com>
Date:   21/10/2016 08:33
Subject:        Re: [weld-dev] Unique BeanIdentifierIndex every time I 
restart a server



Hi Benjamin,

it looks like an integration issue. The index hash should be the same 
unless an ID of a session/conversation scoped bean changes.

Its value is computed using java.util.Arrays.hashCode(BeanIdentifier[]). 
Note that BeanIdentifier.hashCode() is always based on the String 
representation of the ID.

In you case, I can see the difference in:
org.eclipse.osgi.internal.loader.EquinoxClassLoader at d6318459
org.eclipse.osgi.internal.loader.EquinoxClassLoader at b3a3f568

It seems the BeanDeploymentArchive.getId() is different between 
deployments which violates the Weld SPI contract:
"The identifier must be consistent between multiple occurrences of this 
deployment." [1]

It's also possible to disable this optimization:
http://docs.jboss.org/weld/reference/latest/en-US/html/configure.html#_bean_identifier_index_optimization


Martin

[1]
https://github.com/weld/api/blob/master/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi/BeanDeploymentArchive.java


Dne 20.10.2016 v 18:22 Benjamin Confino napsal(a):
> Hello.
>
> I've been investigating a bug relating to session failover and I've
> noticed that my BeanIdentifierIndexhas a different hash every time I
> start and stop the server. This is consistent across every app I tried.
>
> For example:
>
> Upon starting the server I see my debug output
>
> GREP    BeanIdentifierIndex [hash=591986009, indexed=3]
>      0:
> 
WELD%AbstractBuiltInBean%invalidBeansXml#com.ibm.ws.transaction.cdi_1.0.15.20161018-1920.additionalClasses%HttpSession
>
>      1:
> WELD%AbstractBuiltInBean%invalidBeansXml#invalidBeansXml.war%HttpSession
>      2:
> 
WELD%AbstractBuiltInBean%invalidBeansXml#org.eclipse.osgi.internal.loader.EquinoxClassLoader at d6318459[com.ibm.ws.org.jboss.weld.2.4.0:1.0.15.20161018-1920(id=108)].additionalClasses%HttpSession
>
>
> I stop the server, and start it again
>
> GREP    BeanIdentifierIndex [hash=-375657379, indexed=3]
>      0:
> 
WELD%AbstractBuiltInBean%invalidBeansXml#com.ibm.ws.transaction.cdi_1.0.15.20161018-1920.additionalClasses%HttpSession
>
>      1:
> WELD%AbstractBuiltInBean%invalidBeansXml#invalidBeansXml.war%HttpSession
>      2:
> 
WELD%AbstractBuiltInBean%invalidBeansXml#org.eclipse.osgi.internal.loader.EquinoxClassLoader at b3a3f568[com.ibm.ws.org.jboss.weld.2.4.0:1.0.15.20161018-1920(id=108)].additionalClasses%HttpSession
>
>
> Same three classes but the hash is completely different.
>
> My question is simple. Is this the expected behaviour or is this a sign
> that something's gone wrong?
>
> Regards
> Benjamin
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 
3AU
>
>
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>

-- 
Martin Kouba
Software Engineer
Red Hat, Czech Republic



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20161021/abb91b37/attachment.html 


More information about the weld-dev mailing list