Friday 15 July 2011

java - How to find Spring beans.xml -


I have found an EAR with jars and war with my spring definitions, and beans. Xml I am using Maven to build this project. The code inside the jar is trying to find the beans. XML, but he does not know.

Do I want beans In XML:

Meta-INF / Beans Xml of ER?
or
JR's Meta-INF / Beans.xm?

I have tried the following:

Failure 1: Jar's Meta-INF /beans.xml

  String CONFIG_FILE_NAME = "meta-inf / beans.xml"; ApplicationContext Reference = New FileSystemXmlApplicationContext (CONFIG_FILE_NAME); BeanFactry Factory = Reference;   

It gives:

BeansDeployer deployed org.apache.webbeans.exception.WebBeansException: Unable to read the original element of the given input stream. Reason: By: java.net.ConnectException: Connection timed out: Connect

Failure 2: EAR Meta-INF / Beans.xm

  string CONFIG_FILE_NAME = "classpath *: / meta-INF / * bees.xml"; ApplicationContext Reference = New ClassPath XmlApplicationContext (CONFIG_FILE_NAME); BeanFactry Factory = Reference;   

This provides FileNotFoundException because Maven-Earn-plugin simply copys the application.xml but does not include Beans.XML while earning the app. If this is the right method, then is there any way to create Megan in which beans.xmm is formed?

Or should it be somewhere else? According to

Regards

"Generally speaking, - Nothing should be done in the INF. " You think why should it be within the Meta-INF?

But, if you want it to be copied to the meta-INF folder of your ear, then it's under your ejb / src / main / resources / META-INF directory You may need to manually create some of them

No comments:

Post a Comment