Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: @Configurable - can't make it work

  1. #1
    Join Date
    Mar 2006
    Posts
    28

    Default @Configurable - can't make it work

    I am tyring to inject an object using aop, this is what i have, i know i am missing something, please help

    object
    Code:
    @Configurable("user")
    public class UserObject {
        private TestClassI testBean;
        public TestClassI getTestBean() {
            return testBean;
        }
    
        public void setTestBean(TestClassI testBean) {
            this.testBean = testBean;
        }  
    }
    xml set up
    Code:
        <aop:spring-configured/>                          
        
        <bean id="testBean" scope="session" class="test.TestClass">
                <aop:scoped-proxy/>
        </bean>
    
        <bean id="user" class="test.domain.UserObject" scope="prototype">
            <property name="testBean" ref="testBean"/>
        </bean>

    i added the spring-aspect.jar

    what else do i need to do.

    oh yeah, so now i call this from a inex.jsp

    Code:
            UserObject user = new UserObject();
            TestClassI testclassi = user.getTestBean();
            testclassi.printThis();


    i get a null point exception when trying to access the testclass

    thanks for the help

  2. #2
    Join Date
    Dec 2006
    Location
    Normal, Illinois
    Posts
    277

    Default

    Check out this link that explains how to get @Configurable working.

    http://www.aspectprogrammer.org/blog...cal_gui_2.html

    I would speculate that you haven't enable the LoadTimeWeaving correctly.
    Caleb Washburn

  3. #3
    Join Date
    Jul 2006
    Location
    Kolkata, India
    Posts
    217

    Default

    Quote Originally Posted by Goll97 View Post
    i get a null point exception when trying to access the testclass
    Are u using Load Time Weaving or Compile Time Weaving ? Do u get weaving information on the console ? That should indicate whether your class gets weaved with the dependencies.

    - Debasish

  4. #4
    Join Date
    Dec 2006
    Posts
    8

    Default

    I've been documenting my experiences getting @Configurable working properly.
    See this thread - it may have a clue or two:
    http://forum.springframework.org/showthread.php?t=32956

  5. #5
    Join Date
    Mar 2006
    Posts
    28

    Default

    wow great support guys,
    thanks a lot
    must be problem with the weaving, i am trying it, i will let you know what my results are once i got it working

  6. #6
    Join Date
    Mar 2006
    Posts
    28

    Default

    i got it working

    woo hoo,

    I had to spend few minutes to get Load-Time Weaving working with Tomcat.

    what i did is I modified my Catalina file, added the following line to java option
    Code:
    -javaagent:"%CATALINA_BASE%\server\lib\aspectjweaver.jar"
    I am using net beans so other option is to go to the runtime tab, right click on the tomcat server you are using and select platform tab, you can also enter javaagent in the vm parameter.

    Any body know if the javaagent works with weblogic or websphere??

    Are there any alternatives to doing this?? I am not feeling comfortable adding the javaagent.

  7. #7
    Join Date
    Sep 2004
    Location
    Texas
    Posts
    155

    Default

    Compile-time weaving does not require a javaagent.
    Corby

  8. #8
    Join Date
    Mar 2006
    Posts
    28

    Default

    The other option that I know is compiling classes using aspectj, but seems like you are relaying on yet on another framework you know? Is there another way??

    Example would be great,

    thank you

  9. #9
    Join Date
    Jan 2007
    Posts
    10

    Default

    Hi Goll97,

    I have been trying to run a simple logging around advice in tomcat but could not succeede. Is it possible for you to provide a sample war for me ? I am definitely missing something somewhere but unable to find it out. I have posted a thread (tomcat + aop not working) but no one responded.

  10. #10
    Join Date
    Mar 2006
    Posts
    28

    Default

    let check if you are doing every thing ok

    did you include the following jar in you libs:
    aspectjweaver.jar

    I have in my tomcat server lib folder

    did you add the following to your jvm options??


    Code:
    -javaagent:"%CATALINA_BASE%\server\lib\aspectjweaver.jar"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •