I have headache with this problem, which I thought I had resolved but I didn't.
I'm working with a multi-module maven project, Spring and Weblogic, among other technologies. There are some beans with placeholders, which can be fetch from database or pom.xml.
Right now I've have a problem with a particular bean that looks like this:
...
<bean id="idOfMyBean" abstract="true"
class="path.to.my.class"
p:dataSource-ref="path.to.my.datasource"
p:schemaName="${placeholder.that.comes.from.database}"
p:applicationVersion="${application.version}">
</bean>
...
This bean is inside a project which is a jar project, and this jar goes inside my ear project.
My parent pom.xml looks like this:
...
<properties>
...
<!-- Dependencies versions. -->
<spring.version>2.5.6.SEC01</spring.version>
<spring.ws.version>1.5.9</spring.ws.version>
<spring.integration.version>1.0.3.RELEASE</spring.integration.version>
<hibernate.version>3.5.3-Final</hibernate.version>
<slf4j.version>1.6.1</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<application.version>MYVERSION</application.version>
...
</properties>
...
As far I understand, when I do mvn clean install
, the placeholder in the bean is replaced with MYVERSION
. In fact, if I look inside my ear project, I usually use 7zip
to do that, I open the jar and look for the xml file which contains the ben, I can see that is correctly replaced:
...
<bean id="idOfMyBean" abstract="true"
class="path.to.my.class"
p:dataSource-ref="path.to.my.datasource"
p:schemaName="${placeholder.that.comes.from.database}"
p:applicationVersion="MYVERSION">
</bean>
...
Well, when I try to start my applications, it is thrown the following error:
Starting application my-application.
<15-jul-2015 08H52' CEST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating start operation for application, my-application [archive: null], to MY_CLUSTER .>
..................Failed to start the application with status failed
Current Status of your Deployment:
Deployment command type: start
Deployment State : failed
Deployment Message : weblogic.application.ModuleException: :org.springframework.beans.factory.BeanDefinitionStoreException:Invalid bean definition with name 'idOfMyBean' defined in class path resource [path/to/my/bean.xml]: Could not resolve placeholder 'application.version'
No stack trace available.
Problem invoking WLST - Traceback (innermost last):
File "C:\sisii\script\menu_setup.py", line 200, in ?
File "C:\sisii\script\.\lib\menu_system.py", line 110, in run
File "C:\sisii\script\menu_setup.py", line 195, in <lambda>
File "C:\sisii\script\.\lib\config.py", line 2233, in startAll
File "C:\Users\a554236\AppData\Local\Temp\wlst_module12913752580026045681.py", line 320, in startApplication
at weblogic.management.scripting.ExceptionHandler.handleException(ExceptionHandler.java:48)
at weblogic.management.scripting.WLSTUtils.throwWLSTException(WLSTUtils.java:188)
at weblogic.management.scripting.JSR88DeployHandler.startApplication(JSR88DeployHandler.java:768)
at weblogic.management.scripting.WLScriptContext.startApplication(WLScriptContext.java:844)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
weblogic.management.scripting.ScriptException: weblogic.management.scripting.ScriptException: Error occured while performing startApplication : Failed to start the application with status failed
<15-jul-2015 08H53' CEST> <Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than the one in which it was created.>
How is that possible?
The problem could be related with another question I asked before, Cannot import correctly maven properties with PropertiesFactoryBean and PropertyPlaceholderConfigurer in spring, but I though I had resolved, indeed in that question there was another bean which I had problem, but that placeholder problem was with those from database, and now is with those from pom.
Tell me if you need more information.
Thanks in advance.
Greetings.