5 Replies Latest reply on Oct 4, 2011 4:36 AM by lightguard

    Glassfish 3.1.1 + seam config

    umajeric

      I have a problem with Seam Config in Glassfish 3.1.1 (clean installation). When configuring a bean StoreFileSource which is placed inside other jar as a dependency - property 'storeDirectory' is not set. When completely the same class is placed in current project it works fine - as it should (property is set etc.). Bean is initialized fine in both cases (new instance with every request etc.).


      I have a following configuration in beans.xml


      ...
      xmlns:fs="urn:java:my.company.package"
      ...
              <fs:StoreFileSource>
                <s:replaces />
                <s:RequestScoped />
                <fs:LocalStore />
                <s:Named/>
                <fs:storeDirectory>/tmp/local-store/</fs:storeDirectory>
           </fs:StoreFileSource>



      And a bean which implements an interface:


      package my.company.package;
      
      import java.io.File;
      import java.io.FileInputStream;
      import java.io.FileOutputStream;
      import java.io.IOException;
      
      public class StoreFileSource implements FileSource {
      
           private String storeDirectory;
      
      // Other business logic
      
           public void setStoreDirectory(String storeDirectory) {
                this.storeDirectory = storeDirectory;
           }
      
           public String getStoreDirectory() {
                return storeDirectory;
           }
      }
      




      package my.company.other.package;
      
      import java.io.File;
      import java.io.FileInputStream;
      import java.io.FileOutputStream;
      import java.io.IOException;
      
      public interface FileSource {
           // Business methods...
      }



      Exactly the same example works in jetty 8.0.1.v20110908. Just like it should.


      Then again I tried the same class initialization with constructor parameter and Virtual Producer Fields:


           <s:String>
                   <s:Produces/>
                   <gea:LocalStore />
                   <s:value>/tmp/local-store/</s:value>
           </s:String>
      
      
              <fs:StoreFileSource>
                <s:replaces />
                <s:RequestScoped />
                <fs:LocalStore />
                <s:Named/>
                <s:parameters>
                     <s:String>
                          <s:Inject />
                          <fs:LocalStore />
                     </s:String>
                   </s:parameters>
           </fs:StoreFileSource>



      I am getting an exception when deploying the application:


      org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [String] with qualifiers [@LocalStore] at injection point [[field] @LocalStore @Inject private my.company.package.StoreFileSource.storeDirectory]



      And once again the same configuration works fine with Jetty.


      Did anyone experienced the same problems or is this a bug in Glassfish or somewhere else?


      Thanks for help,
      Uros