Menu

class not found...where is it?

Users
2006-12-06
2013-04-08
  • James Clinton

    James Clinton - 2006-12-06

    Which jar am i missing?

    [code]
    2006-12-06 12:15:20,746 ERROR [de.mindmatters.faces.spring.context.ContextLoader] - <Context initialization failed>
    org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [de.mindmatters.faces.spring.factory.aspectj.JsfBeanConfigurerAspect] for bean with name 'de.mindmatters.faces.spring.factory.aspectj.JsfBeanConfigurerAspect' defined in URL [jar:file:/F:/jboss-4.0.5/server/default/lib/jsf-spring-aspects.jar!/META-INF/faces-spring-context.xml]; nested exception is java.lang.ClassNotFoundException: de.mindmatters.faces.spring.factory.aspectj.JsfBeanConfigurerAspect
    Caused by:
    java.lang.ClassNotFoundException: de.mindmatters.faces.spring.factory.aspectj.JsfBeanConfigurerAspect
    [/code]

    Thanks and regards

     
    • James Clinton

      James Clinton - 2006-12-06

      inside jsf-spring-aspects.jar there is a AJ File.

      Is this correct, is there some further config I am missing?

      JSF/SWF/JBoss

       
    • James Clinton

      James Clinton - 2006-12-06

      I'm new to this so I'm not exactly sure what I need right now.

      What I am trying to achieve is quite simple, but made a little more complex because I'm using Spring Web Flow.

      Bascially in my facelet I have an expression which is trying to bind a nested property but isnt working.

      #{parent.value1} <- OK
      #{parent.child.value2} <- FAILS

      I was hoping that jsf-spring would solve my problem...and I correct?.

       
      • Andreas Kuhrwahl

        Hi James,

        i need to know the type of 'parent'! If it's of type UIComponent it won't work (neither with jsf-spring).

         
    • James Clinton

      James Clinton - 2006-12-06

      parent is a bean.  Here's a clear example which should help.

      public class UserAddCommand .. {
        private User user;
        private String text;
        //get/sets
      }

      public class User .. {
        private String text;
        //get/sets
      }

      --Configure spring beans in appCtx
      <bean name="userAddCommand" class="abc.UserAddCommand" scope="prototype" />
      <bean name="test" class="abc.Test" scope="prototype" />

      I've tried adding the User into faces-config.xml but without success.

      #{userAddCommand.text} works.
      #{userAddCommand.user.text} fails.

      THANKS.

       
      • Andreas Kuhrwahl

        Hi James,

        the User of the UserAddCommand is null. You have to set a User programmatically or via DI in the config file.

         
    • James Clinton

      James Clinton - 2006-12-06

      The UserAddCommand is declared in spring.

      Using JSF-EL to extract a string also works, problems arise when getting nested elements:

      --user add command obj.

      <bean
      id="userAddFormAction"
      class="org.springframework.webflow.action.FormAction">
      <property name="formObjectName" value="userAddCommand" />
      <property name="formObjectClass" value="abc.UserAddCommand" />
      <property name="formObjectScope" value="FLOW" />
      </bean>

      Getting to the Test object in UserAddCommand is where I am struggling.  I have tried to declare the bean in spring appCtx and faces-config but without luck.

      I have also tried adding it into 'faces-spring-context'...still no joy.

      Any thoughts?

      kind regards.

       
      • Andreas Kuhrwahl

        Hi James,

        don't get me wrong but i do not see any piece of code where a user ist created (neither a 'new User()' nor a <bean id="myUser" class="abc.User"...> or something similar).

        Kindly regards

        Andy

         
      • Bhushan Bhangale

        Add this kind of config in the faces-config.xml.

        <managed-bean>
                <managed-bean-name>userAddCommand</managed-bean-name>
                <managed-bean-class>UserAddCommand</managed-bean-class>
                <managed-property>
                    <property-name>user</property-name>
                    <value>#{user}</value>
                </managed-property>
            </managed-bean>
        <managed-bean>
                <managed-bean-name>user</managed-bean-name>
                <managed-bean-class>User</managed-bean-class>
            </managed-bean>

         
    • James Clinton

      James Clinton - 2006-12-06

      No worries ;)

      My mistake inthe previous post, test should of been user..

      -----------------------------------------------------------------------------------------
      public class UserAddCommand .. {
      private User user;
      private String text;
      //get/sets
      }

      public class User .. {
      private String text;
      //get/sets
      }

      --Configure spring beans in appCtx
      <bean name="userAddCommand" class="abc.UserAddCommand" scope="prototype" />
      <bean name="user" class="abc.User" scope="prototype" />              <---------- ### CORRECTION ####

      <bean 
      id="userAddFormAction" 
      class="org.springframework.webflow.action.FormAction">
      <property name="formObjectName" value="userAddCommand" />
      <property name="formObjectClass" value="abc.UserAddCommand" />
      <property name="formObjectScope" value="FLOW" />
      </bean>

      I've tried adding the User into faces-config.xml but without success.

      #{userAddCommand.text} works.
      #{userAddCommand.user.text} fails.
      -----------------------------------------------------------------------------------------

      This is all spring config. I have tried declaing user in faces-config, but without success.

      Thanks again, really need to solve this one quickly.

       
      • Andreas Kuhrwahl

        try this:

        <bean name="userAddCommand" class="abc.UserAddCommand" scope="prototype">
            <property name="user" ref="user"/>
        </bean> 
        <bean name="user" class="abc.User" scope="prototype" />

         
    • James Clinton

      James Clinton - 2006-12-06

      Yes that has resolved it. Cant believe i missed that.

      Thanks so much.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.