Maven <configfiles> no properties substitutions

459 views
Skip to first unread message

gill...@hotmail.com

unread,
Jul 10, 2017, 10:15:46 AM7/10/17
to Codehaus Cargo

Hello all


I certainly did something wrong here but I cannot figure out of to have placeholders properties in configfiles replaced by the cargo properties.


I'm trying to setup a local standalone Weblogic 12.1.3.0 container using the Maven plugin.
I took the config.xml file out of cargo-core-container-weblogic-1.6.3.jar and added one single line with static informations.

My pom.xml is configured like this:

      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.6.4</version>
        <configuration>
          <configuration>
            <configfiles>
              <configfile>
                <file>${project.basedir}/src/main/config-cargo.xml</file>
                <todir>config</todir>
                <tofile>config.xml</tofile>
              </configfile>
            </configfiles>
            <properties>
              <cargo.servlet.port>${servlet.port}</cargo.servlet.port>
              <cargo.logging>medium</cargo.logging>
              ...

When executing the cargo:run goal the container cannot start because of such exception:
weblogic.management.upgrade.ConfigFileHelper$ConfigFileException: Unable to read config file version number.


And indeed when I look in the config.xml here's what I've:

<?xml version="1.0" encoding="UTF-8"?>
  <name>domain</name>
  <domain-version>@cargo.weblogic.domain.version@</domain-version>
    <name>domain</name>
    <realm>

The @cargo.weblogic.domain.version@ token hasn't been replaced :-/

When not modifying the config.xml the container start as expected.

Any clues?


Gilles.

Karel Suta

unread,
Jul 11, 2017, 1:11:20 PM7/11/17
to Codehaus Cargo
Hello Gilles,

What container id do you use in Cargo configuration? From container id weblogic121x the property cargo.weblogic.domain.version is not used.
Try to start container without modifying config.xml, copy that file, make there your changes and then use it in Cargo configuration.

Br, Karel


Dne pondělí 10. července 2017 16:15:46 UTC+2 gill...@hotmail.com napsal(a):

gill...@hotmail.com

unread,
Jul 12, 2017, 4:39:33 AM7/12/17
to Codehaus Cargo
Hi Karel

I'm using weblogic121x container (tried with 122x too). After running maven with a remote debugger I could spot that cargo.weblogic.domain was not part of the parameters substitutions.

I tried your suggestion and the container failed with a weird exception, to be sure it was not caused by my changes (more on this below) I took the generated config.xml as-is and placed it in my domain by using the <configfiles> parameter and also the <files> parameter.
To be sure no changes were added to the config.xml that was generated by a successful cargo:run I did a diff between both config.xml (the one in my source tree and the one added to cargo with <configfiles>), there was no difference at all.

Here's the container exception:

<Jul 11, 2017 6:14:03 PM CEST> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: A MultiException has 2 exceptions.  They are:
1.
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
2.
java.lang.IllegalStateException: Unable to perform operation: post construct on weblogic.server.channels.ChannelService

A MultiException has 2 exceptions.  They are:
1.
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
2.
java.lang.IllegalStateException: Unable to perform operation: post construct on weblogic.server.channels.ChannelService

       
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:447)
       
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
       
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
       
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
       
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
       
Truncated. see log file for complete stacktrace
Caused By: java.lang.AssertionError: java.lang.reflect.InvocationTargetException
       
at weblogic.descriptor.DescriptorManager$SecurityServiceImpl$SecurityProxy._invokeServiceMethod(DescriptorManager.java:180)
       
at weblogic.descriptor.DescriptorManager$SecurityServiceImpl$SecurityProxy.decrypt(DescriptorManager.java:197)
       
at weblogic.descriptor.DescriptorManager$SecurityServiceImpl.decrypt(DescriptorManager.java:119)
       
at weblogic.descriptor.internal.AbstractDescriptorBean._decrypt(AbstractDescriptorBean.java:1187)
       
at weblogic.management.configuration.SecurityConfigurationMBeanImpl.getCredential(SecurityConfigurationMBeanImpl.java:908)
       
Truncated. see log file for complete stacktrace
Caused By: java.lang.reflect.InvocationTargetException
       
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       
at java.lang.reflect.Method.invoke(Method.java:498)
       
at weblogic.descriptor.DescriptorManager$SecurityServiceImpl$SecurityProxy._invokeServiceMethod(DescriptorManager.java:178)
       
Truncated. see log file for complete stacktrace
Caused By: weblogic.security.internal.encryption.EncryptionServiceException: com.rsa.jsafe.JSAFE_PaddingException: Invalid padding.
       
at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptBytes(JSafeEncryptionServiceImpl.java:139)
       
at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptString(JSafeEncryptionServiceImpl.java:187)
       
at weblogic.security.internal.encryption.ClearOrEncryptedService.decrypt(ClearOrEncryptedService.java:99)
       
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       
Truncated. see log file for complete stacktrace
Caused By: com.rsa.jsafe.JSAFE_PaddingException: Invalid padding.
       
at com.rsa.jsafe.JSAFE_SymmetricCipher.decryptFinal(Unknown Source)
       
at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptBytes(JSafeEncryptionServiceImpl.java:124)
       
at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptString(JSafeEncryptionServiceImpl.java:187)
       
at weblogic.security.internal.encryption.ClearOrEncryptedService.decrypt(ClearOrEncryptedService.java:99)
       
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       
Truncated. see log file for complete stacktrace
>
<Jul 11, 2017 6:14:03 PM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED.>
<Jul 11, 2017 6:14:03 PM CEST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down.>
<Jul 11, 2017 6:14:03 PM CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN.>



So now, about what I'm trying to achieve...

My application use a custom AuthenticationProvider which must be defined in the realm, I also need to change the control flag of each AuthenticationProvider to OPTIONAL and re-order the list to have my custom one as first.
I also need to have enforce-valid-basic-auth-credentials set to true in the domain.

I tried several approaches (offline WSLT, online WSLT, config.xml substitution) and all of them failed for different reasons:
  • WLST offline: fail when executing the create('NameOfMyAuth', 'ClassOfMyAuth', 'AuthenticationProvider'), ClassOfMyAuth is not known by WebLogic. Normal, we are offline and the AuthenticationProvider JAR is not yet loaded.
  • WLST online: works nicely to apply my changes except that some are not dynamic changes and need a container restart to be applied, which make cargo fail because it loose connection with the container.
  • config.xml: see above
The last option I didn't tried was to use a "runtime" container instead of "standalone" but I don't like this approach as I have dozens of different projects with different requirements and don't want to have dedicated WL instances per projects.

I REALLY like the philosophy behind cargo, being able to abstract any kind of application server deployment, mostly for my maven functional testing but I think I will give a try to Docker now as WebLogic is a real pain to manage (in general).

Gilles.

S. Ali Tokmen

unread,
Jul 16, 2017, 1:27:23 PM7/16/17
to codehau...@googlegroups.com

Hi Gilles

I think the config.xml approach would only work with the weblogic12x container, as the later versions use the WSLT tool (which seems to be managing config.xml itself). Have you tried that combination?

Also, for the missing class issue, does adding the file to the container classpath help?

Please advise

S. Ali Tokmen
http://ali.tokmen.com/
http://contact.ali.tokmen.com/
--
You received this message because you are subscribed to the Google Groups "Codehaus Cargo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codehaus-carg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codehaus-cargo/9bf39171-5a9a-4415-863e-a83b0e7a62fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages