Advertisements

Thursday, January 23, 2020

kubectl taking long to respond

After creating my first pod in Kubernetes I noticed that is taking a very long time to respond when using commands like:

kubectl get all

Am I using a Virtual Box machine running a Linux Mint distro and using microK8s using snap.

I fixed using the following instructions given by Tatsuro:

Please replace user:user part with your login username
sudo chown -R user:user ~/.kube


Tuesday, February 5, 2019

Camel - How to call local ejb using Spring DSL

In the camel context specify these two things


 
 
 
     
 


 
 
 
     
      

 


Then by invoking the EJB, you need to have identified the JNDI name which can be browsed in the Wildfly/JBoss console mostly under "JNDI tree view"


 



Here is the EJB  and impl used:

@Stateless
public class ExampleServiceImpl implements ExampleService, ExampleServiceLocal {

 public String greet(String name) {
  // TODO Auto-generated method stub
  return "Hello " + name + "!";
 }

 public Map<Object> getSystemProperties() {
  // TODO Auto-generated method stub
  return new HashMap<>(System.getProperties());
 }

}

 
@Local
public interface ExampleServiceLocal {
 
 public String greet(String name);
 
 public Map<Object> getSystemProperties();
 
}

Monday, August 20, 2018

Wildfly - Call local EJB from Camel Processor

Here are 2 steps you need to have in order to instantiate a EJB local instance.


  1. Specify the module dependency at the descriptor from the caller.
  2. Add the dependency where the interface are located
Module Dependency

By default, Java EE deployment units (jars, ejb-jars, wars, ears-and-their-contents) are isolated from each other. In other words, classes in one deployment unit do not have access to classes in other deployment units.

If your EJBs and interfaces are packaged in a jar named sample-engine-ejb-1.0.jar, then you can make the classes in this jar accessible to your web application by adding a WEB-INF/jboss-deployment-structure.xml file to it with the following content:
xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
    <deployment>
        <dependencies>
            <module name="deployment.sample-engine-ejb-1.0.jar" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Maven Dependency

Caller needs to have access to the EJB local interface to cast the instance of the EJB.


  
   com.sample.ejb
sample-engine-ejb ejb 1.0 provided

How to fix Java Illegal key size


This is because you do not have unlimited strength jurisdiction policy files installed.
Install one of the following:
Extract them to: ${java.home}/jre/lib/security/

Monday, October 23, 2017

XSLT how to handle XML and node set content in variables

It is very helpful to persist a xml node in a variable that we can query later using xpath, we can accomplish this easily, however you have to make sure the XML transformer (I use Xalan) you are using has to be compatible.

Having the following xml document to play around:

 
 1
 Article1
 This is article 1
 
 
 2
 Article2
 This is article 2
 
 
 3
 Article3
 This is article 3
 

1.- How to use a XSLT variable that holds a XPATH node set so we can use it as a variable in our XSLT.
1.1.- Build the variable using xpath and only get the node set that is required using a predicate
1.2.- Use the variable same way we use xpath expression Here is the xslt:
Here is the output:
Name: Article1
Desc: This is article 1




Notes: You might need to include this in the namespace depending on which transformer you are using:
extension-element-prefixes="exsl"

This is an extension that allows to manipulate xml documents within a variable.

Friday, August 18, 2017

XSL left-right padding

Here is an example of howto accomplish padding situations:

For example if you want to right pad a 10 spaces string you can do:
<xsl:value-of 
 select="substring(concat($string, '          '), 1, 10))"/>

if you need a left pad you can change the order of the concat parameters as following:
<xsl:value-of 
 select="substring(concat('          ', $string), string-length($string)+1, 10))"/>

Now you can build a template function to call it.

Thursday, August 10, 2017

How to set a timeout for a Web Service Invocation/PartnetLink

Here is how to set a timeout when invoking a web service,:

Just go an open the composite properties, also there are other properties that are very useful.



The value in the property is in milliseconds.