Define contextroot inside WAR file - deployment

I have an automated deployment script to deploy multiple WAR files in WAS 7.
So, I would like to define contextroot inside the WAR file itself. It should automatically set to " ... -contextroot xxxx ..." from the file.
How do I do that? I think, I need to add something with WEB-INF/ibm-web-bnd.xml.
I dont know what to write in it.
Pls help, thanks.

Create WEB-INF/ibm-web-ext.xml with these contents:
<web-ext
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
version="1.0"
>
<context-root uri="/TestProject"/>
</web-ext>

Related

WildFly: jboss-cli's add module creates a wrong folder

I am taking my very first steps with WildFly application server. I want to create a database driver.
I had a look at https://www.adam-bien.com/roller/abien/entry/installing_oracle_jdbc_driver_on on how to do it manually. And now I want to do it by jboss-cli.sh. I read about these commands e. g. here and here.
So I am typing...
wildfly-26.0.0.Final/bin$ ./jboss-cli.sh -c
[standalone#localhost:9990 /] module add --name=com.oracle --resources=/home/user/Downloads/ojdbc8.jar --dependencies=javax.api,javax.transaction.api
The command is going to be executed without error.
I would expect it to
create the module-subfolders (step 2 in the linked tutorial by Adam Bien)
copy the JAR file to the newly created folder (step 3)
create the module.xml file (step 4)
maybe even to add the necessary <driver /> tag in the standalone.xml (do not know if that should be part of the add module command?) (step 5)
Basically it does a lot of that, but different than I expect.
It creates the subfolder in a wrong(?) location. It is not created in [WILDFLY_HOME]/modules/system/layers/base/com/oracle/main like it is decribed by Adam Bien but it is created [WILDFLY_HOME]/modules/com/oracle/main. The JAR file is correctly copied, the module.xml file is created but the folder seems to be wrong. And the standalone.xml is not altered at all.
If I start the web management console I do not see the driver next to the default H2 one.
So my question is what am I doing wrong with the command so that the folder is created in the correcy localtion? Or does this work as designed and the location is not that relevant and I am making other mistakes that it does not show in management console nor in standalone.xml?
By the way, I also tried to change the command module add --name=system.layers.base.com.oracle .... Now the folder was correct, but in the module.xml the name of the module was also system.layers.base.com.oracle.
I tested with WildFly 26.0.0 and WildFly-preview 26.0.0 under Ubuntu.
It should not be created in modules/system/lasers/base. That is for components provided by the container. Having the module off the root $JBOSS_HOME/modules directory is correct.

WSDL service location base URL will be different in each environment and how to not build the same jar over and over again

I have a wsdl file, which contains service-tag and partial view of it:
<service name="EXFlowers">
<port binding="getflowers:EXFlowersGetflowers" name="EXFlowersGetflowersService">
<soap:address location="http://dev.example.com:67857/EXFlowers/getflowers" />
</port>
</service>
My problem is in this part:
<soap:address location="http://dev.example.com:67857/EXFlowers/getflowers" />
I am using wsdl2java which creates .java files from the wsdl file (then I compile the generated files and make a jar file out of it for using it in WebSpehere).
As it is now I can't promote a .jar file from one environment to another (for example: development -> test -> staging -> production), because the location in each environment has different base url. I hate to run wsdl2java for each environment (basically create the same jar 5 times with just different string values in some of the class files). I want "build once, run anywhere" workflow and I found this from IBM's support page https://www.ibm.com/support/pages/accommodating-different-wsdl-urls-between-environments which explains how it could be done.
So my question is:
Can a kindly soul explain me with syntax examples how option 2 can be done:
Use a file:// based WSDL URL. Store the WSDL file itself in the same file path in each environment, but use different contents with
custom hostnames and/or endpoint URLs therein.
I don't understand it, how will it look like:
<soap:address location="file://tmp/myendpointfile.txt and what about this part -> /EXFlowers/getflowers" />
and how will the content of the file be ?
cat /tmp/myendpointfile.txt
http://dev.example.com:67857
I would appreciate any help or if you guys know a better way of accomplishing this task.

VSTS - releasing environment-specific web.config

I have a web.config.test & web.config.production checked into my project. These get built and released to an on-prem server. I think the Command Line task will work to copy the correct file as web.config but I can't figure out how to resolve to the path, as my build is zipped up. Something like
copy web.config.$(Release.EnvironmentName) web.config
but it fails not being able to find the specified file. I echo out the $(Release.EnvironmentName) and it writes "test" to the log, so that's the correct filename, but not sure what the path would be to the file inside the zip. Any ideas?
You need to extract zip file, then copy files, after that you can archive files.

Jenkins Plugin for Writing to the Change Log?

Does anyone know of a Jenkins plugin which will allow you to easily set your own values for the "Changes" portion of a build?
We're manually performing our own SCM syncs, and so we don't currently have access to or know how to change the "Changes" portion of the build status.
Thank you for your help!
There is no specific plugin to do it.
Each builds change log is saved in a location like "C:\Program Files (x86)\Jenkins\jobs\BuildJobName\builds\2014-09-11_21-30-25\changelog.xml"
You can manually edit it or write an app which edits the changelog.xml
The format of the changelog.xml is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<log>
<logentry revision="16349">
<author>LeoN</author>
<date>2014-10-24T08:33:57.708042Z</date>
<paths>
<path action="M" localPath="Binaries\Plugins\product.wxs" kind="file">/trunk/Project Phases/Development/Binaries/Plugins/product.wxs</path>
<path action="M or D or A" localPath="LocalPath From repo" kind="dir or File">Svn Path</path>
</paths>
<msg> Fixed Issues.</msg>
</logentry>
</log>
Action attribute can have values such as M,D,A
M - Modifications
D - Deletes
A - File or folder additions
I suggest you write an app to do this.

Web.Config Transformations just copy the web.*.config Files

I'm fairly new to this but it seems really simple and i want to know why on earth it is not working. I have create a bunch of regions configuration manager (test, UAT, dr prod ect.) and then i have right clicked on my web.config and added config transformation, filled out the relevant files.
Now when i go to Build deployment package for a region and them import it onto another machine it just copies out the web.test.config or whatever files. Does anyone know what I'm doing wrong?
Help?!
Josh
For those facing this bastard of a problem, you need to have do not copy on for all of your files and build action = content
Web transformation files get copied to root + bin