Results 1 to 10 of 14

Thread: Loggin AOP problem

Hybrid View

  1. #1
    Join Date
    Dec 2009
    Posts
    14

    Default Loggin AOP problem

    I have try to log with AOP but nothing seems to work it's like no logging want to appear i've tried from System.out.println to the INFO logger nothign!!!

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/aop
           http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
    <import resource="applicationContext.xml"/>
        <aop:config>
            <aop:aspect ref="LoggingAspect">
                <aop:pointcut id="myCutLogging"
                              expression="execution ( * org.ksique.ui.support.*.*(..) )"/>
                <aop:around pointcut-ref="myCutLogging" method="log"/>
            </aop:aspect>
    
        </aop:config>
    
        <bean id="LoggingAspect" class="org.ksique.aop.LogginAspect" />
    
    </beans>

  2. #2
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    Try to use your setup with the single config '*.xml' file (i.e. inline 'applicationContext.xml' content in place of '<import resource="applicationContext.xml"/>')

  3. #3
    Join Date
    Dec 2009
    Posts
    14

    Default Try that but nothing

    I Tried that but still the same problem. BTW i logged directly on a method from a class in ui.support.* and log pretty fine but i cannot get it done with AOP.

    Another small detail i am using IceFaces but i dont think that would matter to much right?

  4. #4
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    Quote Originally Posted by necronet View Post
    Another small detail i am using IceFaces but i dont think that would matter to much right?
    Not sure about that. General spring aop idea is to create aop proxy and provide it to the client instead of the target 'raw' bean. Every time proxy method is called it performs aop processing if necessary and delegates to the target 'raw' bean.

    That may be the case that IceFaces usage interferes with aop proxies construction and no proxy is created. Another possible case is that the proxies are created but they are not called, i.e. the call is performed on a 'raw' instance etc.

    I think that the best way to find the problem is to emulate it as a minimal but complete standalone example, post it here and ask for help on concrete example.

  5. #5
    Join Date
    Dec 2009
    Posts
    14

    Default Thank you

    This is a little sample of what i want to do but i haven't being able to get it work

    i attached the src and web.
    Attached Files Attached Files

  6. #6
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    Sorry, but your example is incomplete - it doesn't contain information about libraries and versions that should be used with it.

    I tried it with tomcat 6.0.20 and the following key dependencies:
    HTML Code:
            <dependency>
                <groupId>myfaces</groupId>
                <artifactId>myfaces-jsf-api</artifactId>
                <version>1.0.9</version>
            </dependency>
    
            <dependency>
                <groupId>org.apache.myfaces.core</groupId>
                <artifactId>myfaces-impl</artifactId>
                <version>1.2.7</version>
            </dependency>
    
            <dependency>
                <groupId>org.icefaces</groupId>
                <artifactId>icefaces</artifactId>
                <version>1.8.2</version>
            </dependency>
    
            <dependency>
                <groupId>com.sun.facelets</groupId>
                <artifactId>jsf-facelets</artifactId>
                <version>1.1.14</version>
            </dependency>
    However, I'm getting the following on Tomcat startup:
    Code:
    Dec 14, 2009 4:18:19 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
    java.lang.LinkageError: loader constraints violated when linking javax/el/ELResolver class
    	at org.apache.myfaces.webapp.Jsp21FacesInitializer.configureResolverForJSP(Jsp21FacesInitializer.java:122)
    	at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:76)
    	at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:88)
    	at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:72)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
    	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
    	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
    	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:585)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    I can check your example if it's really standalone (no servlet-container involved) or if you provide complete example configuration (maven pom.xml is fine for that).

Tags for this Thread

Posting Permissions

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