13 Replies Latest reply on Jan 29, 2010 11:37 AM by maxandersen

    Unknown context variable name:

    scatudal

      I get this warning for every components that comes from the seam package.

      Identity, Credentials and LocaleLocator do the same.

      My application works fine though.

      Every time the projects builds, warnings are duplicated so my list of warnings grows until I do a Clean.

      I don't want to remove the warnings reported by the Context Variables Validator for obvious reasons.

      I'm using the following :
      -Seam Tools for Eclipse Version: 2.1.2.GA
      -Eclipse 3.3.2

      How can I fix this.

      Thanks

        • 1. Re: Unknown context variable name:
          maxandersen

          If this is the JSF validator provided by WTP then it does not know about Seam components and thus it will continue to report such issues.

          • 2. Re: Unknown context variable name:
            scatudal

            It's in my session beans. In the code bellow, identity, credentials and localLocator cause an "Unknown context variable name: "%variableName%" warning.

            package org.domain.SeamOne.session;
            
            /* imports...
             */
            
            @Stateless
            @Name("authenticator")
            public class Authenticator implements IAuthenticator {
            
             @Logger
             Log log;
            
             @In
             Identity identity;
             @In
             Credentials credentials;
             @In
             LocaleSelector localeSelector;
            
             @Out(scope = ScopeType.SESSION)
             UserInfo currentUser;
            
             @PersistenceContext
             private EntityManager em;
            
             /*
             * (non-Javadoc)
             *
             * @see org.domain.SeamOne.session.IAuthenticator#authenticate()
             */
             public boolean authenticate() {
             log.info("authenticating {0}", credentials.getUsername());
             // write your authentication logic here,
             // return true if the authentication was
             // successful, false otherwise
            
             if ("admin".equals(credentials.getUsername())) {
             identity.addRole("admin");
             return true;
             } else {
            
             currentUser = (UserInfo) em
             .createQuery(
             "select u from UserInfo u " + "where u.userLogin=#{credentials.username} and " +
             "u.password=#{credentials.password}").getSingleResult();
            
             if (currentUser == null) {
             return false;
             } else {
             log.info("setting locale to '{0}' for '{1}'", currentUser
             .getLocale(), currentUser.getUserLogin());
            
             localeSelector.setLocaleString(currentUser.getLocale());
             localeSelector.select();
             return true;
             }
             }
             }
            }
            


            Is there any way I can tell eclipse how to resolve these?

            Thanks

            • 3. Re: Unknown context variable name:
              akazakov

              Which version of Seam (runtime) do you use?

              Can you reproduce it on JBossTools 3.0 & Eclipse 3.4?

              • 4. Re: Unknown context variable name:
                scatudal

                I'm using currently using "jboss-seam-2.1.0.SP1".

                I'll try reproducing it on JBossTools 3.0 & Eclipse 3.4 but it looks like I'll have to do a clean install of Eclispe. Doesn't seam to be an easy upgrade button! ;)

                I'll get back to you as soon as test is done.

                Thanks

                • 5. Re: Unknown context variable name:
                  akazakov

                  JBoss Tools 2.* doesn't support Seam 2.1 fully. So your JBDS installation can't pick up some core variables (identity, credentials, ...). Please use JBoss Tools 3.0 which supports Seam 2.1. I recpmend you the latest nightly build.

                  • 6. Re: Unknown context variable name:
                    scatudal

                    I lost a lot of time with this today...

                    For some reason, JBoss Tools 3.0 will not install in eclipse 3.4.1. It hangs when I try to install it with the eclipse updater. It says that it is downloading org.eclipse.birt.integration.wtp.ui and it stays at 5% forever.

                    I tried downloading the complete JBoss Tools 3.0 package and extracting it to eclipse folder and then starting eclipse with the -clean so it refreshes my plugins list, but no success again.

                    It's beta so I guess I should expect this...

                    • 7. Re: Unknown context variable name:
                      maxandersen

                      sylvain, try and unselect the Birt feature and see if it installs fine for you then.

                      We have had issues with the Birt dependencies not being downloaded correctly under Eclipse Ganymede.

                      • 8. Re: Unknown context variable name:
                        scatudal

                        It finally installed and now I get 337 warnings instead of 8. ;)

                        I get syntax error warnings on EL Stuff generated by seam-gen. All attributes from variables coming from the "var" attribute of rich:dataTable are unresolved. Context assist for those variables don't work.

                        here is an example:

                         <rich:dataTable var="_addressType"
                         value="#{addressHome.instance.addressType}"
                         rendered="#{addressHome.instance.addressType != null}"
                         rowClasses="rvgRowOne,rvgRowTwo"
                         id="addressTypeTable">
                         <h:column>
                         <f:facet name="header">Id</f:facet>
                         <h:outputText value="#{_addressType.id}"/>
                         </h:column>
                         <h:column>
                         <f:facet name="header">Name</f:facet>
                         <h:outputText value="#{_addressType.name}"/>
                         </h:column>
                         <h:column styleClass="action">
                         <f:facet name="header">Action</f:facet>
                         <s:link id="viewaddressType"
                         value="View"
                         view="/AddressType.xhtml">
                         <f:param name="addressTypeId"
                         value="#{_addressType.id}"/>
                         </s:link>
                         </h:column>
                         </rich:dataTable>
                        

                        The lines in blue are those of interest.

                        Note that this test project works fine when deployed.

                        Anyway, I guess I'll live with the few warnings that get duplicated every build. I've lost all the time I could trying to tweak the IDE.

                        Thanks for your time,



                        • 9. Re: Unknown context variable name:
                          maxandersen

                          You can disable the warnings in Validator preferences.

                          But i'm concerned you get that many...could you create a jira with a sample project?

                          • 10. Re: Unknown context variable name:
                            scatudal

                            In order to make sure that I had all the steps required to reproduce the behavior, I created a project from scratch with seam-gen in a new workspace and guess what, problem fixed.

                            I no longer get warnings so I guess that your first answer that I didn't understand at the time was probably the right one.

                            "max.andersen@jboss.com" wrote:
                            If this is the JSF validator provided by WTP then it does not know about Seam components and thus it will continue to report such issues.



                            I didn't make the difference between the two at the time. Just started looking at the java EE 5.0 world. Did lots of java in the past but let's say that the framework has evolved in the last 6 years! ;)

                            Thanks for your help.

                            • 11. Re: Unknown context variable name:
                              maxandersen

                              happy to help :)

                              Let us know if you bump into other issues !

                              • 12. Re: Unknown context variable name:

                                How exactly did this resolve your issue.  I am seeing the exact same thing in my eclipse project.  How did you change your JSF validator so that it recongized the seam components?

                                 

                                Thanks

                                • 13. Re: Unknown context variable name:
                                  maxandersen

                                  James, the thread explains about the JSF validator differences and how to enable/disable them.

                                   

                                  If you got some other issue I suggest you create a new thread with info about what versions of Tools you are using and what exact problems you are seeing since this thread is old by now.