How to have Liberty Profile eagerly load apps on startup - websphere-liberty

Liberty Profile is loading EARs and WARs we deploy to it only when the server receives it's first request. How can we tell it to eagerly load applications upon server start?
We're using the latest 8.5.5 WLP.
Thanks,
Stu

You can configure the WebContainer to fully initialize the application prior to the first request by adding the following to your server.xml:
<webContainer deferServletLoad="false"/>

Related

How to auto load apps in WAS LIberty 16.0.0.2? [it auto loads apps in 17.0.0.2 with the same configs]

So, we have two Liberty servers with different versions.
WAS Liberty 16.0.0.2, and
WAS Liberty 17.0.0.2
Both of servers has the same configuration
But, the problem is, even with the same configuration, WAS Liberty version 17.0.0.2 will auto load application context/servlet on start/restart without sending a request to them, while WAS Liberty version 16.0.0.2 will not auto load application context/servlet on start/restart unless we send a request on it.
As per our search regarding this issue. In the IBM Knowledge center, it says that by default Liberty defers servlet loading until a request is received for the associated web application... but in WAS Liberty version 17.0.0.2, it will automatically load the servlet/application context.
Help will be very much appreciated for this one.
Note: we did not add <webContainer deferServletLoad="false"/> in our server.xml
Liberty used to deploy the web application on first request. That was the behaviour in 16.0.0.2. I don’t recall exactly when we changed when we deploy, but we updated to deploy async during startup rather than on first request since a number of people were expecting their servlet inits to be triggered sooner than first request.

Weblogic Database Connectionpool Unbinds , when the spring application is undeployed

I'm developing a spring(4.3.2 release) application and it uses 2 connectionpool for the database operations.
The problem is that the connectionpool is unbinded from JNDI , when the application is un-deployed and it's not available for the next deployment.
This issue is happening only in the PRE-PRODUCTION environment and doesn't occur in the TEST.
Please help me with your thoughts
Thanks,
Vimal

is there a equivalent tomcat valves concept in websphere liberty profile?

I have a webapplication which was deployed on tomcat and uses tomcat values, now the application is moving to websphere liberty and am not sure similar concept exists in liberty.
Is there an equivalent tomcat valves concept in websphere libery profile? If yes, how can we achieve ?
You can white/blacklist hostnames and ip addresses on a per-endpoint basis in server.xml. Blocked ones will get a connection reset message.
<httpEndpoint httpPort="19080" httpsPort="19443"
id="defaultHttpEndpoint" tcpOptionsRef="myTcpOptions" host="*"/>
<tcpOptions id="myTcpOptions" hostNameExcludeList="*.foo.com,*.ibm.com" />
There's more info on that here:
https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/urun_chain_typetcp.html
If you need different exclusions per app, you can use configure multiple endpoints and map them to applications using virtual hosts.
https://www.ibm.com/support/knowledgecenter/en/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/cwlp_virtual_hosts.html

How to migrate WAS 7.5 to Liberty Profile 8.5?

I am looking to migrate my application to run on Liberty profile 8.5 instead of Websphere Application server 7.5. In this process, I need to do server configuration by setting up LDAP, Database source and JMS. As I am new to Liberty profile, I am looking for help in setting up these. May I get some suggestions from you to complete these settings?
This is a bit broad question, so I'll give you some pointers to documentation to get you started (There is no WAS 7.5, so you probably mean 7.0).
WebSphere Application Server Liberty Profile Guide for Developers - this will give you some basic general information to get you started with Liberty
Data source configuration - basic configuration is quite simple, you define it in server.xml file (you didn't mention which DB you are using, so here is sample with Derby)
<library id="derby">
<fileset dir="${shared.resource.dir}/derby"/>
</library>
<jdbcDriver id="derbyDriver" libraryRef="derby"/>
<dataSource jdbcDriverRef="derbyDriver" jndiName="jdbc/DataSourceJNDI" type="javax.sql.ConnectionPoolDataSource">
<properties.derby.embedded createDatabase="false" databaseName="D:\path\DB"/>
</dataSource>
For more specific information regarding migrating DB2 data sources see
Migrating a DB2 data source to the Liberty profile
LDAP configuration - basic configuration for MS Active Directory
<ldapRegistry id="ldap" realm="SampleLdapADRealm"
host="ldapserver.mycity.mycompany.com" port="389" ignoreCase="true"
baseDN="cn=users,dc=adtest,dc=mycity,dc=mycompany,dc=com"
bindDN="cn=testuser,cn=users,dc=adtest,dc=mycity,dc=mycompany,dc=com"
bindPassword="testuserpwd"
ldapType="Microsoft Active Directory">
<activedFilters
userFilter="(&(sAMAccountName=%v)(objectcategory=user))"&(sAMAccountName=%v)(objectcategory=user))"
groupFilter="(&(cn=%v)(objectcategory=group))"
userIdMap="user:sAMAccountName"
groupIdMap="*:cn"
groupMemberIdMap="memberOf:member">
</activedFilters>
</ldapRegistry>
For more details and other LDAP see Configuring LDAP user registries with the Liberty profile
JMS - as you didn't provide details, if you are acting as JMS server or client and which JMS provider are you using (default or MQ), check this page as starting point for JMS related configuration - Liberty profile: JMS messaging
Application migration - if you want to check, if there are any issues with your application code regarding migration, you can install plugin for Eclipse/RAD -
WebSphere Application Server Migration Toolkit – Liberty Tech Preview which will scan your code for incompatibilities.

configure jndi.xml in serviceMix to work with MQseries

My j2EE app is currently running on ServiceMix. Now i want to add JMS to my app. The application should able to send/receive the JMS message to/from the queue that stays on MQSeries.
mq.hostname=10.3.6.19
mq.channel=CHANNEL
mq.queueManager=QManager
mq.port=1422
What i would like to do is:
1. Create a jndi.xml file and do configuration for jms stuff.
2. my app will initialize the context, look up jndi name, and create a connection, queueManager, queue. .etc
3. Develop send and receive methods.
My question is:
Can you tell me how to do 1st and 2nd steps.
(the script inside ServiceMix's jndi is diffrent with tomcat's
jndi and others.
ServiceMix using Spring based JNDI provider.
http://servicemix.apache.org/jndi-configuration.html)
I just ran into something similar with Weblogic. The following link uses spring-dm to integrate with websphere. It also takes it to the next logical step and adds camel to the mix.
http://lowry-techie.blogspot.com/2010/11/camel-integration-with-websphere-mq.html
Without using Spring-dm, you may run into classloader issues when trying to load the InitialContextFactory from the websphere jar (this is an issue I had with the Weblogic jar)

Resources