SOAPUI: how to refer to external jars? - jar

Commonly known, that for usage of different jars we need add them to SoapUI/../ext/ directory. for example, for correct work of jdbc requests with IBM/..AS400JDBC Driver we need to add jt400.jar to /ext dir.
But I have problem: my client implements new policy - direct forbidding of using any jars locally, only as dependencies like
<dependency>
<groupId>net.sf.jt400</groupId>
<artifactId>jt400-full</artifactId>
<version>6.0</version>
</dependency>
I successfully uses it in my POM's for CI, but I also need to run my projects in SOAPUI.
So, question is: is there any way to add dependency for external jars, - exists in SoapUI preferences somewhere/somehow? Goal is to remove all jars from soapui/../ext and somehow add dependencies on official.
Sincerely,
Dmitry.

I have thought about this some more: You should be able to roll your own soapui.bat, based on the provided one.
Copy the provided soapui.bat to your desktop.
Modify the variable SOAPUI_HOME to point to your install.
Modify the variable CLASSPATH to include your jars.
Run the modified soapui.bat.

Related

Spring Cloud contract jar versioning

I have established Spring cloud contract between two microservices in my project successfully. Everything was good until yesterday.
On consumer side, I am referencing the latest version of stubs like below:
#AutoConfigureStubRunner(ids = {"com.example:http-server-dsl:+:stubs:8080"})
But this causes problem in some cases where the producer side reverted their latest version and switched back to previous version.
Or
somehow there is a situation that the jar that contains current stubs has a lower version than the latest version in maven repo.
Is there a way in Spring cloud contract to do either one of the following?
1) configure the consumer side to pick up the current project version (referring to project version in pom.xml) instead of the latest version from maven repo?
Or
2) configure the producer side to have a static version of stubs jar but keep dynamic version of other project jars. This would allow the consumer side to refer to the same static version of stubs jar
I read the documentation https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/2.1.1.RELEASE/single/spring-cloud-contract.html#_jar_versioning but it did not help
You can play around with the provided version. We give + to always download the latest. You can set a concrete value e.g. 2.1.1.RELEASE. You can also set ranges. All in all we're using Ivy underneath so you can check out the rules of Ivy http://ant.apache.org/ivy/history/latest-milestone/settings/version-matchers.html
1) configure the consumer side to pick up the current project version instead of the latest one?
What does current mean? Is it the latest? Latest release? If it's the latest release pick + but point to the repo that contains release versions only without snapshots.
I read the documentation https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/2.1.1.RELEASE/single/spring-cloud-contract.html#_jar_versioning but it did not help
What is missing in this section? You asked about static stubs, we describe it there too #AutoConfigureStubRunner(ids = {"com.example:http-server-dsl:2.1.1:stubs:8080"}).
Following worked (for maven project).
Step1: Instead of specifying the ids in #AutoConfigureStubRunner, we can provide it inside application.properties file like below (notice #project.version#, this refers to maven project version )
stubrunner.ids=com.example:http-server-dsl:#project.version#:stubs:8080
Step2: To be able to use #project.version# in properties file, add the following in build section of pom.xml:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
And in plugins section:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${mvn-resources-plugin.version}</version>
<configuration>
<delimiters>
<delimiter>#</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>

How to get config file for Cordapp?

How to get config file for Cordapp in Java like in sample?
serviceHub.getAppContext().config
After getAppContext() i can't find anything about config file.
This feature is not available in Corda 3. As of this answer, it is only part of the unstable master branch. It will be included in a future release of Corda.
However, you can implement this manually for now as follows: How to provide a CorDapp with custom config in Corda?.

Apache Karaf - bundle starts but does nothing?

I'm new to Karaf. I have a jar that has a class App with a method main. When I drop the jar in the The Karaf log service console says the bundle is started but nothing seems to happen. The first thing (the jar) does is a simple database write so I can see if it's running (no log file is generated although one is expected).
The jar depends on lots of other jars. Our sysadmin will not install Maven on the production servers. Where does one put helper jars (like mysql-connector-java-[version].jar)?
Does Karaf use the Manifest file to find the main class? Do I have to implement some special interface or something?
thanks for any help.
As Karaf is a OSGi Container, you should first read some stuff on how to write proper OSGi bundles.
First of all you'll need a Activator that'll start your bundle (just like a main). A Main Class is never interpreted. Yes Karaf, as it is a OSGi container, does "read" the Manifest, but to make sure first it's a proper OSGi bundle second how the resolving should take place by reading Package-Import/-Export.
Regarding the "Packaging" - using lot's of other jar's/bunldes - , you'd either can built a custom Karaf (read the Karaf documentation on how to do this) or create a KAR for your Bundles containing your bundles and a feature.xml (again take a look at the documentation at Karaf)

External classes/jar in OSGi

My application supports running on many dbms and it requires user to configure dbms connection setting and also provide the jdbc jar file.
Now the application is to be packaged as OSGi bundle. There will be another main jar which lanches OSGi server and starts the application as bundle.
Can you please suggest how can I package the application as bundle and let user provide the jdbc jar file.
Will it require something like the main launcher jar specifying JDBC driver classes as FRAMEWORK_SYSTEMPACKAGES property?
Thanks in advance,
Aman
There are two ways of doing this:
1) Adding the driver.jar to the classpath of the main launcher and, like you say, expose its packages via the framework by specifying that property (or actually you can use the FRAMEWORK_SYSTEMPACKAGES_EXTRA property to just specify additional packages, instead of specifying all of them).
2) Manually wrapping the driver.jar as a bundle, or doing it dynamically at runtime. For example, you could try to wrap bundles that are copied to a certain folder (similar to what Apache Felix File Install does) by using Pax URL or some other tool that can create a bundle out of an ordinary jar file for you (see http://team.ops4j.org/wiki/display/paxurl/Pax+URL).

include model libraries in appclient jar

I'm deploying an ear with an EJB onto glassfish 3.1 which I want to call using the appclient script.
The EJB has a method with as parameter a model object which is defined in a separate library.
If I want to use the appclient script I have a Main class with a main method which calls the EJB.
This is also put into a separate jar which is also deployed onto glassfish.
As the model object is located in a separate library I need it in the client jar but also in the EJB.
So I need to reference it somehow in the client jar.
The client jar is a jar (duh) so I cannot add other jars. The Java EE 6 docs say that I should create an ear with the libs but if I do that it doesn't deploy because an ear needs at least an ejb or web module and my client lib has neither.
The solution I found is using the assembly plugin/jar-with-dependencies. This plugin creates a new jar which contains all classes of all dependencies.
This solution works but I'm wondering if this is the way to go or I'm missing something obvious because I cannot imagine this is required. EJB's usually have model objects as parameters so this situation will happen a lot.
So my question is: is there a way to tell glassfish to reference the shared libraries between the app client jar and the ejb jar.
The way I do this is like this:
Separate Maven project with the model. In my case that's a bunch of simple POJOs with JPA and JAX-B annotations, some constants, etc. In Maven, I define this as an OSGi bundle, by specifying <packaging>bundle</packaging>. I call this project MyAppInterface.
Separate Maven projects for other elements that need to deal with the model. In my case, I have one Java EE application with EJBs, Database facade, REST servlet; I have an Integration-Test project which only does tests; a GWT application; etc... In those projects I specify the dependency to the model:
<dependency>
<groupId>com.skalio</groupId>
<artifactId>MyAppInterface</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
When deploying MyAppInterface to Glassfish, I use the following syntax:
asadmin deploy --type osgi --name MyAppInterface /path/to/MyAppInterface-1.0-SNAPSHOT.jar
I understand it that this is placing the model on the classpath of Glassfish, similar to a mysql-connector, only OSGi-style.
I let all these projects be built by a central jenkins CI server, which deploys the artifacts to our internal maven repository. We then add the internal repository in pom.xml of each project. As a result, everyone automatically works with the latest stable MyAppInterface, even if they don't have the code checked out in NetBeans / Eclipse.
Let me know if you need more examples.

Resources