This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 179923 - Web Beans error annotation for non CDI enabled modules
Summary: Web Beans error annotation for non CDI enabled modules
Alias: None
Product: javaee
Classification: Unclassified
Component: JSF Editor (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 normal (vote)
Assignee: Denis Anisimov
Depends on:
Reported: 2010-01-27 08:42 UTC by Jindrich Sedek
Modified: 2011-01-14 06:07 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Jindrich Sedek 2010-01-27 08:42:44 UTC
Create new Java Library and add weld-osgi-bundle.jar or some other weld jar containing javax.inject package.

Create new java class:
package dd;
import javax.inject.Named;
public class NewClass {
    private String str = "test";
    public String getStr() {
        return str;
    public void setStr(String str) {
        this.str = str;

Create new Web Application with javaEE 6 with CDI and JSF enabled 
add previous java library as a dependency to the Web Application
in index.xhtml type:
<html xmlns=""
        <title>Facelet Title</title>
      <h:form id="UserEntryForm">
        <h:inputText value="#{|newClass.str}" />
        <h:commandButton action="welcome" value="OK" />
note that cc offers "newClass" at position of "|"

run project -> text field is empty, type something in, press ok -> an error appears: >>Target Unreachable, identifier 'newClass' resolved to null<<

The problem is that the java library doesn't declare being CDI enabled - having beans.xml. (create beans.xml in META-INF directory of java library and it starts working). 

The bug is that we offer this class in cc, because it's usage is not valid in this case. Not offering the class name in cc would be very non-transparent for users. It would be better to propose the name in cc, but add a warning (and possibly also a autogeneration hint) to create beans.xml file in META-INF directory of the library.

See the URL of this bug with the description how beans.xml file should work.
Comment 1 Marek Fukala 2010-01-27 08:59:01 UTC
I recon that this is a problem of the web.beans module which mark classes as web beans when it sees a class with the @Named annotation on the project's classpath. It does so regardless if modules from the classpath has the CDI enabled or not.

I'm not sure if Denis works for us or not anymore, but if he cannot fix the issue I may give it a try by some sort of classpath filtering.
Comment 2 David Konecny 2010-01-27 17:54:12 UTC
Feel free to pass webbeans(CDI) problems to me - Denis is not working on it anymore.

I agree with Jindra that code completion should list beans even from modules which are not CDI enabled. Could we mark them differently in code completion (grey?) to indicate the difference? Also using such a bean should add editor hint saying "<bean-name> will not be available in runtime because CDI is disabled for <something.jar>" and there should be autofix option "Enable CDI for <something.jar>" which would just create beans.xml.

Do you agree Marek? Should I do it or would you prefer do it all or some parts yourself? I'm not very familiar with JSF editor implementation/code completion but I can give it a try.
Comment 3 Marek Fukala 2010-01-28 02:49:01 UTC
Feel free to do it Davide. I can help you with the editor part if you want.  

If you extend the web beans API or create some reasonable utility method which can be used for mapping the web beans classes to the source jars I can do the editor part quickly. I can do it all if you are busy anyway but the truth is that I'm currently fiddling with the css/html refactoring so I would do it later.
Comment 4 Denis Anisimov 2011-01-13 12:56:53 UTC
changeset:   186107:2d3ea0c3acaf
Comment 5 Quality Engineering 2011-01-14 06:07:08 UTC
Integrated into 'main-golden', will be available in build *201101140000* on (upload may still be in progress)
User: Denis Anisimov <>
Log: Fixes for BZ#179923 -  Web Beans error annotation for non CDI enabled modules  and BZ#194119 -  java.util.ConcurrentModificationException at java.util.LinkedList$ListItr.checkForComodification