aspose file tools*
The moose likes Other Application Frameworks and the fly likes HELP accessing Class Path Xml ApplicationContext in aar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "HELP accessing Class Path Xml ApplicationContext in aar file" Watch "HELP accessing Class Path Xml ApplicationContext in aar file" New topic
Author

HELP accessing Class Path Xml ApplicationContext in aar file

Darvesh Niz
Ranch Hand

Joined: May 12, 2008
Posts: 119
Hi All,
i am using axis and my webservice is packaged as an aar file inside my axis archive. Right now i am using a startup servlet class SpringInit which implements ServiceLifeCycle and i initilize the ClassPathXmlApplicationContext when the startup method is called when the services are initialized. This is a pretty standard way of doing it as mentioned in teh axis documentation and mentoined below.

Now the issue is how can i get hold of application context in my webservice code for example generally in a normal spring app we put spring context file under WEB-INF classes folder and use singleton class such as mentioned below


If i try this code in my webservice it says applicationContext.xml file not found which is correct sicne the aar file is not packaged as regular J2ee spec. The classpathpahtxml context has to initialized using the axisSerive class loader.
Could any body tell me whats the best practice of getting hold of the application context in the webserivce code.

FYI, as of now in order for my code to work i have a static variable and i have set that varibale when the starup method initilaized the class path xml context.
Hence my new startup method has this extra code where i set teh static variable applicationContext of ProjectApplicationContext Class like this

ProjectApplicationContext.applicationContext = appCtx;

Is this correct or totally against teh code best practices and land me in trouble. Please let me knwo


Thanks
Rashid
Darvesh Niz
Ranch Hand

Joined: May 12, 2008
Posts: 119
Any body please have any update on this

Thanks
Darvesh Niz
Ranch Hand

Joined: May 12, 2008
Posts: 119
I will appreciate if anybody can give some input on this.
Rashid
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HELP accessing Class Path Xml ApplicationContext in aar file
 
Similar Threads
why to implement BeanNameAware
Can't Retrieve EntityManager With Multiple Dao Persistence
JMS implementation using JNDI in spring application
Setting classpath dependency between projects in Eclipse
Scheduling job.