How to set keep alive in weblogic using WLST? - weblogic12c

I have requirement to automate the server deployment process; I have found a way to do it using WLST. However I am stuck at one point.
I need to set some configurations in weblogic,
for e.g.
cmo.setGracefulShutdownTimeout(300)
cmo.setIgnoreSessionsDuringShutdown(true)**
But I could not find method to enable Keep Alive for HTTP protocol in weblogic server.
I have tried below combinations but that did not work:
cmo.setKeepAliveEnable(true)
cmo.setKeep-Alive(true)
cmo.setKeepAlive(true)
Kindly tell me how to enable keep alive property of HTTP protocol in weblogic using WLST.
Thanks in advance.

Related

Load properties into application based on Weblogic managed server

I have this requirement - I have several managed servers running on my Weblogic (version 12.x). There are multiple machines as well.
Machine 1: Managed server 1, 2
Machine 2: Managed server 3, 4
I have a spring-boot based application (war) that is deployed across all managed servers. It has both an MDB (to read messages from JMS queue), and a SOAP Webservice.
The queue that it is reading messages from is however targeted/deployed only on a few managed servers - 1 and 3.
Now, I don't want my application to fail or start complaining when it doesn't find the queue on managed servers 2 and 4. Hence, I wish to load my MDB based on a property/configuration specific to managed server.
Is there any way to achieve this?
You could add a custom System property to the server start parameters of server 2 and 4 in the admin console, ie: "-DignoreMDB=1" and read that using a System.getProperty("ignoreMDB") != null call. Note that you need to restart the nodemanager first and your managed servers second to get modification to the server start parameters active.

Drools controller URL responding with error code 405

We are exploring Drools BPM for one of our new project. I am basically from .Net background and doesn't have much knowledge with java techs.
Our expectation is that we should able to create rules and workflows using Drools so that it can be exposed as REST API's and then the rules should be executed from .net/angular client applications using this REST.
I have configured the KIE server using WildFly10 server. It seems that all my configurations are working fine but when i try to connect to controller ("http://localhost:8080/kie-wb/rest/controller") it gives the below error message.
Error Message :
2018-01-22 12:30:09,263 INFO [org.kie.server.controller.websocket.client.WebSocketKieServerControllerImpl] (KieServer-ControllerConnect) Kie Server points to non Web Socket controller 'http://localhost:8080/kie-wb/rest/controller', using default REST mechanism
2018-01-22 12:30:09,263 WARN [org.kie.server.common.KeyStoreHelperUtil] (KieServer-ControllerConnect) Unable to load key store. Using password from configuration
2018-01-22 12:30:09,274 WARN [org.kie.server.services.impl.controller.DefaultRestControllerImpl] (KieServer-ControllerConnect) Exception encountered while syncing with controller at http://localhost:8080/kie-wb/rest/controller/server/wildfly-kieserver error Error while sending PUT request to http://localhost:8080/kie-wb/rest/controller/server/wildfly-kieserver response code 405
The below URL's are working fine
http://localhost:8080/kie-wb
http://localhost:8080/kie-server/services/rest/server/
http://localhost:8080/kie-wb/rest/controller/management/servers
I was able to get both workbench and kie server to work on the same web and/or app server following various examples that are proliferated on the internet. However, I encountered this particular error when setting up for a more realistic production ready environment using separate app servers on the same host running on different ports. The issue is, the REST version of the url is only supported when both workbench and kie server are running on the same app or web server. When on separate app or web servers, it must use web sockets (see docs for property org.kie.workbench.controller):
http://docs.jboss.org/drools/release/7.8.0.Final/drools-docs/html_single/#_wb.systemproperties
Only Web Socket protocol is supported for connecting with a remote Kie Server Controller. When specifying this proporty, the Workbench will automatically disable all the features related to running the embbeded controller.
After reading this, the 405 makes sense (method not allowed). I changed the URL from
http://ACTUAL_HOST_NAME:8080/kie-drools-wb/rest/controller
to
ws://ACTUAL_HOST_NAME:8080/kie-drools-wb/websocket/controller
and that resolved the 405.
Also, I was originally using 'localhost' for the actual host name, but it still would not connect, so I changed it to the actual host name. Finally, I was still seeing a connection problem and then found out that both servers need
-Dorg.kie.workbench.controller.user=kieserver
-Dorg.kie.workbench.controller.pwd=kieserver1!
-Dorg.kie.server.user=kieserver
-Dorg.kie.server.pwd=kieserver1!
to be set on both servers (See https://groups.google.com/d/msg/drools-setup/Bpt-r_bIa2U/g0H1J77sBgAJ and https://groups.google.com/d/msg/drools-setup/Aru_F98nL9g/Z6vUCm6hBQAJ).
Edit:
After fiddling with it some more and read the documentation a little bit more, the referenced documentation was referring to workbench connecting to an external controller, instead of configuring the controller within workbench.
After much torment, my problem was solved by adding role "kieserver=kie-server,rest-all" and user "kieserver" to Business Central Workbench.
Without this data, I consistently received 405.

Connect to JMX using PowerShell

I am not a developer so please keep that in mind when reading the following message:
I need to be able to use Windows PowerShell to connect to a JMX RMI agent on a host, is this even possible ?
The example string from the java client I have been given is as below:
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:7979/jmxrmi");
The reason for this is that I am doing other work in my PowerShell script and would like to keep it all in one place.
Thanks !
This is an unusual mix of two technologies, but it is possible.
On the off-chance that you are attempting to connect to a JBoss server, the quickest way may be for you to call twiddle, a command tool that will dispatch JMX requests to the target JBoss server and return the results to standard out.
Another way is to implement the Jolokia agent on the target servers. This will allow you to issue JMX requests using REST. Responses will also be returned in REST format which you can process in PowerShell using one of these solutions.
Thirdly, you can also deploy the JMX-WS service on your target servers which will allow you to communicate with the JMX server using web-services. This document provides some VBScript examples of this.
None of the above actually uses the JMXServiceURL syntax you outlined, and I cannot think of a way you could actually cleanly integrate this RMI based protocol into PowerShell, but hopefully one of the above will work for you.
========== UPDATE ==========
There may be a way to use the RMI implementation. Take a look at IKVM. It is a Java Byte Code to .NET compiler. I have successfully compiled JMX/RMI java code into a .Net assembly and used it from C#. I think PowerShell will do the same thing.

How do I get more details on my request error on IIS7

I have deployed a REST service on an external server (IIS7). When I start the service from VS on the Dev server it works fine. But on the server i get:
Request Error, The server encountered an error processing the request. Please see the service help page for constructing valid requests to the service.
How do I get more details on this error? I have looked in the log files directory that is configured under Logging feature for this web site in IIS Manager, but there are no files at all for this site it seems.
You should look in the Windows Event Log using the Event Viewer application (eventvwr.exe). Output to the IIS log files may be buffered so their contents may be updated after a restart, or when IIS is set to do it. Restarting IIS is a surefire way to force this.
Here is a blog post on how to do this.
I'm aware of 3 ways to get nicer errors:
Set UseVerboseErrors in InitializeService method. However, this won't give you anything if your error occurs before InitializeService is called (which happens).
Set IncludeExceptionDetailInFaults to true using an attribute before your service class.
Set IncludeExceptionDetailInFaults to true using web.config.

What is the reason for using of Service Binder while running multiple JBoss (JBoss 4.2)

I found couple of tutorials how to run multiple instances of JBoss on the same machine.
All of them mention uncommenting Service Binder and having separate service-binding.xml files for each server.
The question is why it's done like that? Is there any reason except adding additional layer of indirection?
It looks the same could be done by modification of ports in jboss-service.xml for each server. The only restriction would be that there won't be easy way to switch which instance of JBoss uses which set of ports.
You are right with modifying the ports in jboss-service.xml. This is the straightforward and genuine way to change the ports.
Unfortunately, ports are not only defined in that file, but also in other places like jboss-web's configuration etc.
Catching all those places can be error prone.
So the idea was to have a central file (service-binding.xml) that lives in the root of a server installation. You basically copy the 'default' config to server1, server2 etc and then via command line pass in the server name when starting so that the correct port-offset for all of the services is taken from service-bindings.xml and applied to the resulting runtime configuration.
JBossAS 7 takes this concept one step further to the ServiceBindingGroups, where the base ports are defined on a domain level and then per server you pick a basic group + just a port offset by name, so that there is even less work needed than in as4