Mysterious Entry in my Swagger Doc

Recently, I’ve been working with Swagger to document my team’s APIs, and had a mysterious entry popup (default/entity). It looks something like this:

Swagger
Swagger

I threw some tracing into action:

(io.swagger.*=ALL:*=INFO)
[6/7/16 7:51:24:912 EDT] 00000039 id= io.swagger.jaxrs.utils.ReaderUtils < collectParameters Exit 
 []
[6/7/16 7:51:24:912 EDT] 00000039 id= io.swagger.jaxrs.utils.ReaderUtils < collectFieldParameters Exit 
 []
[6/7/16 7:51:24:912 EDT] 00000039 id= io.swagger.jaxrs.utils.ReflectionUtils > isOverriddenMethod Entry 
 public javax.ws.rs.core.Response org.eclipse.persistence.jpa.rs.resources.MetadataResource.getMetadataCatalog(java.lang.String,java.lang.String,javax.ws.rs.core.HttpHeaders,javax.ws.rs.core.UriInfo)
 class org.eclipse.persistence.jpa.rs.resources.MetadataResource
[6/7/16 7:51:24:912 EDT] 00000039 id= io.swagger.jaxrs.utils.ReflectionUtils > isOverriddenMethod Entry 
 public javax.ws.rs.core.Response org.eclipse.persistence.jpa.rs.resources.MetadataResource.getMetadataCatalog(java.lang.String,java.lang.String,javax.ws.rs.core.HttpHeaders,javax.ws.rs.core.UriInfo)
 class org.eclipse.persistence.jpa.rs.resources.common.AbstractResource
[6/7/16 7:51:24:912 EDT] 00000039 id= io.swagger.jaxrs.utils.ReflectionUtils > isOverriddenMethod Entry 
 public javax.ws.rs.core.Response org.eclipse.persistence.jpa.rs.resources.MetadataResource.getMetadataCatalog(java.lang.String,java.lang.String,javax.ws.rs.core.HttpHeaders,javax.ws.rs.core.UriInfo)

I had too broad a dependency in my Maven pom.xml. I switched from eclipselink to org.eclipse.persistence.jpa.

<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.6.3</version>
</dependency>

The swagger entries disappeared from my swagger.yaml and it’s subsequent view.   I hope this helps.

Localized Maven Repositories – A Hot Tip

I’ve been building a Maven Project that uses some jar files which are not in Maven Central (or any repository). I ran across this article – Local Maven Dependencies. I found it very helpful.

Simply, do the following:

create a directory (d:/folder/repo)

Run a maven deploy to url (it’ll create the repository details based on the flags)

mvn deploy:deploy-file -Durl=file://d:/folder/repo/ -Dfile=Common.jar -DgroupId=xyz -DartifactId=Common -Dpackaging=jar -Dversion=1.0

and add to your Maven Project’s POM
<repository>
<id>Local Repository</id>
<name>project</name>
<url>file:${project.basedir}/../mylibrary.project/src/repo</url>
</repository>

Then reference your jar file with a new dependency.

The code should almost write itself from there 🙂

IBM Integration Broker with ODBC and ESQL

To setup ODBC bridge from IBM Integration Broker to DB2, download and install the ODBC bridge from the IBM Data Server Runtime Clients.  It’s a 1.3 G download, and you only need about a 40M file for your system.

The installation is straight foward.  Be prepared to click Next, and Finish.

Setup the ODBC bridge and IIB

Start > Run

      Type ODBC
      Click on Data Sources
      Click on Configure ODBC
 Username
 db2admin
 Password
 fakepass!
 IP
 9.32.18.166
 Port
 50000
 Database name
 SAMPLE
 

call the alias as SAMPLE

      Launch a Command prompt
      Start > Run
      cmd
      change directory to server\bin
      Launch iib
      C:\Program Files\IBM\IIB\10.0.0.4\server\

bin>mqsisetdbparms.exe TESTNODE_cheetah -n SAMPLE -u db2admin -p fakepass!

      BIP8071I: Successful command completion.
      TESTNODE_cheetah should be your local node in Eclipse.
        you’ll want to restart the Node (you can look in the lower right of your toolkit)
      Right Click the Node
      Stop
      Then Start

To Read Data, the ESQL is easy:

        You can then send a message using the IIB tests , and confirm using your database db2 select * from DB2ADMIN.EMPLOYEE.

 

To Write Data:

      Repeat the project with the following:
      Create a New Input Message with

{
"EMPNO" : "2229",
"FIRSTNME" : "Paul",
"LASTNAME" : "B",
"JOB" : "PRES",
"EDLEVEL" : 18
}

IBM Integration Broker – Setting up DB2 JDBC Access

I have been working IBM Integration Broker 10.0.0.4.

I found it hard to find concise documentation (read as fast) on setting up/creating a new provider

mqsicreateconfigurableservice TESTNODE_cheetah -c JDBCProviders -o DB2Two -n connectionUrlFormat -v "jdbc:db2://[serverName]:[portNumber]/[databaseName]:user=[user];password=[password];"

mqsisetdbparms TESTNODE_cheetah -n jdbc::employeeIdentity -u db2admin -p passw0rd1940!

mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n securityIdentity -v employeeIdentity
 mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n portNumber -v 50000
 mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n serverName -v 9.32.18.166
 mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n databaseType -v DB2
 mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n databaseName -v SAMPLE
 mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n jarsURL -v c:\db2jars

mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n type4DatasourceClassName -v com.ibm.db2.jcc.DB2XADataSource
 mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n type4DriverClassName -v com.ibm.db2.jcc.DB2Driver

mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n databaseVersion -v 10.1
 mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n environmentParms -v ""

mqsichangeproperties TESTNODE_cheetah -c JDBCProviders -o DB2Two -n jdbcProviderXASupport -v true

Restart the Integration Server

I referenced this
http://webspheremb.blogspot.com/2011/12/how-to-configure-jdbc-on-message-broker.html

You can use a Java Compute node to access the data.
https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ac30494_.htm%23ac30494_

Further details… http://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ah61310_.htm?lang=en

Maven Tips

Here are some tips for Maven Java Projects in Eclipse.

#1 If you pom.xml is missing maven-compiler-plugin, Eclipse (when you do Maven > Update Project), defaults the compiler level for the project to 1.5.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>

Now, it gets even more tricky… if your project has defined features that are from Java 1.6, 1.7 or 1.8

#2 if you your web.xml defines a version not compatible with a project facet you depend on, you get a lot of problems/errors

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"/>

Convert the web.xml to 3.1, and compatibility should now be fixed

<web-app id="WebApp_ID" version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">

I found this stackoverflow entry helpful and this one.

#3 Update > Maven Project overwrites manual changes to #1/#2.

I found this stackoverflow entry helpful.

#4 Make sure you don’t have two web.xml files… the convert dynamic web project to maven project does some funky stuff.