[JBoss AOP Users] - JBoss Microcontainer with JBoss AOP in a standalone app.
by pekarna
Hi,
I'm trying to create a standalone app using JBoss Microcontainer for IoC and JBoss AOP for, well, AOP.
I've boot-strapped, deployed a descriptor with AOP XML, so far so good.
But the aspect is not performed. Do I need to enable AOP plugin ors something?
Please check the code below.
Thanks for help.
| <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
| xmlns="urn:jboss:bean-deployer:2.0"
| xmlns:aop="urn:jboss:aop-beans:1.0">
|
| <bean name="myGarage" class="cz.zizka.ondra.jbmctest.Garage">
| <property name="car">
| <bean name="myCar" class="cz.zizka.ondra.jbmctest.Car">
| <property name="name">Red Devil</property>
| </bean>
| </property>
| </bean>
|
| <aop:interceptor name="FuelInterceptor" class="cz.zizka.ondra.jbmctest.FuelInterceptor"/>
|
| <aop:bind pointcut="execution(* cz.zizka.ondra.jbmctest.Car->set*Fuel(..)">
| <aop:interceptor-ref name="FuelInterceptor"/>
| </aop:bind>
|
| </deployment>
|
| public static void main( String[] args ) throws Throwable
| {
| // Bootstrap.
| BasicBootstrap bootstrap = new BasicBootstrap();
| bootstrap.run();
|
| // Load the bean definitions.
| URL url = Thread.currentThread().getContextClassLoader().getResource("jboss-beans.xml");
| BasicXMLDeployer deployer = new BasicXMLDeployer( bootstrap.getKernel() );
| deployer.deploy( url );
|
| KernelController cont = bootstrap.getKernel().getController();
| ControllerContext context = cont.getInstalledContext("myGarage");
| System.out.println( "I have a garage: "+context.getTarget());
|
| // Put some fuel in.
| Car myCar = (Car) cont.getInstalledContext("myCar").getTarget();
| myCar.setLitresOfFuel( myCar.getLitresOfFuel() + 1 );
| System.out.println( "I have a garage: "+context.getTarget());
|
|
| deployer.shutdown();
|
| }
|
| public class FuelInterceptor implements Interceptor {
|
| private static final Logger log = Logger.getLogger( FuelInterceptor.class.getName() );
|
| public Object invoke(Invocation invocation) throws Throwable
| {
| System.out.println( "In FuelInterceptor." );
| if( true ) throw new Exception(); // To see that it's really NOT called.
| Object target = invocation.getTargetObject();
| long time = System.currentTimeMillis();
| log.info("Invocation [" + target + "] start: " + time);
| try{
| return invocation.invokeNext();
| }
| finally{
| log.info("Invocation [" + target + "] time: " + (System.currentTimeMillis() - time));
| }
| }
|
| public String getName() {
| return FuelInterceptor.class.getName();
| }
| }// class FuelInterceptor
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264485#4264485
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264485
16 years, 5 months
[Beginner's Corner] - Re: jboss with website root which sits deep in the app
by down7ime
"PeterJ" wrote : That is not a problem - you can have several directories nested within the deploy directory, and apps within those directories. As an example, look at server/xxx/deploy/management. Note that that console SAR application is located within that directory. The only real requirement is that application directory contain a suffix, such as WAR, so that JBossAS will know what type of app it is.
|
| For example, this directory path would be acceptable for deploying a web app:
|
| server/xxx/deploy/project/site/root.war
Thanks for the response peter, your suggestion puts the war folder where the application document root is, this will work perfectly if all the files i needed to process were under that document root, unfortunately i need jboss to render files above that root, namely;
server/xxx/deploy/plugins/
server/xxx/deploy/core/
as well as the document root, ie
server/xxx/deploy/project/site/root.war
so could i some how do something like this?
server/xxx/deploy/root.war/plugins/
server/xxx/deploy/root.war/core/
server/xxx/deploy/root.war/project/site/site.war
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264475#4264475
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264475
16 years, 5 months
[Beginner's Corner] - Re: jboss with website root which sits deep in the app
by down7ime
Hey Guys,
Giving this another shot and running into the same issue, i need to know how to define the webroot of an application in JBoss, not sure if this is possible but its a requirement for the framework im using.
basically i have the following structure
/root.war
/root.war/projects/app/www <-- web application root
/root.war/plugins <!-- framework files
/root.war/core <!-- framework files
So i have the whole /root.war directory correctly parsing cfml (my framework files and application files), now i need a way to tell jboss to serve all requests from my application root, ie:
/root.war/projects/www/site/www
At the moment jboss deploys the site like this
009-11-09 11:15:52,546 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) deploy, ctxPath=/
2009-11-09 11:15:53,062 INFO [STDOUT] (main) ===================================================================
WEB CONTEXT
-------------------------------------------------------------------
- config:C:\Domains\railo-deploy\root.war\WEB-INF\railo
- webroot:C:\Domains\railo-deploy\root.war\
i would like to change the webroot location above to
- webroot:C:\Domains\railo-deploy\root.war\projects\site\www\
can this be done? note i still need jboss to parse files under root.war/plugins and root.war/core since the web app needs these files.
Any idea how i can get this done, i have tried added context-path, appBase, docBase and a number of other things to
/root.war/WEB-INF/jboss-web.xml
also tried creating
/root.war/WEB-INF/context.xml
and added context, appBase and docBase to
$jboss\server\$instance\deploy\jbossweb.sar\server.xml
most of which caused errors, can anyone suggest the right way to do this? or even if its possible, as you can see im completely lost as to how this should be defined.
Any help/advice appreciated, thanks.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264474#4264474
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264474
16 years, 5 months