简体   繁体   中英

How to access existing application context running in tomcat in external main class

My web application is running in tomcat 6. We are using DOJO for UI and web services for data access. Currently, there is a webservice available to clear/build the cache in our application. As we are access this using a https/http, it is holding huge memory and taking much time to process.

so currently we are planning to take this process out of web services and wanted to execute as a standalone app.

I need to have a standalone (backend) application (may be main class) which should do the above activity.

The problem is that all beans used to clear/build the cache are available in application context (meaning inside the tomcat container).

  1. I want to access the same available beans in external main class and do the process.. (possible ?)
  2. How to get the application context outside the tomcat scope, I mean in external java class ?
  3. Else, can i have another application (jar file with one main class file) which i will deploy it with the same application and trigger it via tomcat (possible?), so that the application context is available for the main class thereby we can access the beans/context.

Earlier in my previous project, we have used EJB home and remote interface to connect to main class (jar file with only one main class containing EJB connecting code) deployed along with the application. But the applciation server is WEBSPHERE.

can we do the same thing in tomcat.

kindly help on this... thanks in advance for your replies...

我认为这是不可能的,JAVA管理自己的内存,不允许您通过其他应用程序来操作内存。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM