• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring AOP and EJB 2.0 Integration.

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

My current project EAR file (JAR and WAR) is deployed and running in production for many yrs. The EJB 2.0 was part of JAR file. I would like to do some operation before invoking the particular method in a EJB with out touching the EAR file. So wrote simple class which implements MethodBeforeAdvice interface (Spring AOP) and generated runable jar file using eclipse which has set it in the application server classpath. So that new java file will pickup as per the applicationContext configuration and perform the operation as I expected. The new jar file includes applicationContext.xml file and spring AOP depends JAR files like aop, bean, core and aopalliance. In the applicationContext XML file, mapped org.springframework.aop.framework.ProxyFactoryBean with target as EJB Bean class and InterceptorNames as new class name.

I set the jar file in the server classpath and restarted server in unix box but handshake between new jar file and ear file is not happening when I invoke the EJB. The new jar file should invoke before I call particular method in EJB (After look up EJB). Any idea or suggestions?


Regards
Mohan
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AOP can be applied to classes at 2 different times: compile-time and run-time. Compile-time AOP is basically annotations that add features to the generated class code. Run-time requires a re-weaving of the original compiled code to add the features as part of the overall class-loading/instantiation process.

I'm not sure precisely what mechanisms are going to be needed here - plus when Eclipse runs the application server, it can sometimes do rude and unpleasant things to the server's configuration.

In the case of Tomcat using JPA, I have to include 2 Spring libraries into the Tomcat server's lib directory, one of which is the spring-tomcat-weaver.jar. Your webapp server, whatever it may be, probably needs something similar.
 
Attractive, successful people love this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic