Where can i find the maven dependencies for Webshpere eXtreme Scale? - java

I have been googling for some days now about this. I am trying to develop a spring boot application (which is going to be deployed into a Websphere Liberty Profile Server), and is going to connect to Websphere Extreme scale for caching. I went through several documentations and guides, but none of them provide an actual source of where to find the dependencies for connecting to wxs from a maven built application.
I had assumed that the required jars should have been bundled along with the wxs liberty feature installation. But I could not find it in the lib directory of the server either.
I believe I am looking for
file=objectgrid.jar,groupId=com.ibm.websphere.objectgrid,artifactId=objectgrid,version=8.6.0.2
Any links towards a sample java maven application that connects to wxs will also be helpful.
Thanks in advance

The required jars are indeed included in the WXS Liberty installation. However the namings were'nt objectgrid or ogclient as stated in different docs.
The only required client jar for developing a wxs client application is sized at 15MB, named com.ibm.ws.xs.client_1.1 and in the directory [WASDir]/dev/ibm-api.
You can add this jar to your applications build path and develop wxs client applications.
If you are using maven, (I was), you could install the above jar in your local maven repository with a mvn install:install-file -Dfile=? -DgroupId=? -DartifactId=? -Dversion=? -Dpackaging=jar and use the installed dependency in your project.
Note that, these are only for development purposes.(as are all the Liberty Features)

Related

Running Liberty server as embedded from maven using maven dependencies

IBM Liberty documentation claims that it is possible to start/stop/manage Liberty server using SPI directly from the code. I'd like to use such functionality to create integration tests for my REST services.
Reference on original article:
http://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/twlp_extend_embed.html?lang=en
I want to create integration test that:
1) Start Liberty server with my own 'server.xml'. I want to provide specific DataSource and security here.
2) Deploy an EAR application on Liberty server.
3) Run REST-Assured tests on Liberty server.
4) Undeploy application and shutdown Liberty server.
Basically I stuck on 1st stage - I can't start server because I am getting 'NoClassDefFoundError: com.ibm.ws.kernel.boot.EmbeddedServerImpl' exception. The link above describes that 'ws-server.jar' from Liberty installation must be used, but what about referencing it from maven dependencies? I suppose that I could specify some artifact from IBM maven repo 'https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/' and use it to start Liberty as embedded server directly from my unit tests, but I can't find what that artifact should be.
So, to rephrase myself: what would be maven artifact in IBM's repository that contains EmbeddedServerImpl class? And is it enough to include that artifact or there are more of them required for liberty embedding?
You can't reference it from the Maven repository because it must be part of the Liberty installation that you want to start as it uses it's location to work out what it is starting.
I wrote an article and sample a little while ago outlining different techniques for writing functional/integration tests against Liberty including using a JUnit Rule with the Embedded Server starting and stopping the server:
https://developer.ibm.com/wasdev/docs/writing-functional-tests-liberty/
https://github.com/WASdev/sample.functionaltest
This was using Gradle to do the build script part so I included the launch JAR with:
fvtRuleCompile fileTree(dir: "${libertyRoot}/bin/tools", include: 'ws-server.jar')
The same can be achieved in a Maven build environment by using a System Dependency:
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#System_Dependencies
I don't think the ws-server.jar is provided in the IBM Maven DHE repository, only Liberty API's and SPI's and some packaged runtimes are provided to the user as Maven dependencies.
By the way, if you're using artifacts from the IBM Maven DHE repository, you may want to change them for the ones that are now provided in Maven Central, see:
http://mvnrepository.com/artifact/com.ibm.websphere.appserver

Best way to execute embedded Jetty

I have a web application that is structured into a standard war. I want to use embedded Jetty server as my servlet container. Since this is all one code base, I figured that the main() that executes the Jetty server would also be in my war with the rest of the code.
So how do I go about executing my main(), which is in the war, to launch the Jetty server? I looked at the examples but the examples do not have this setup, which to me seems like a normal setup.
Would the Jetty server need to be told where the war file is (the war file that happens to be where its also located) or would Jetty by default find and check WEB-INF for the various XML files what Jetty processes?
I see something close to this using the Jetty Maven Plugin, but the consensus is that that plugin is not for production.
I was able to setup an executable file easily using the Maven plugin called Jetty Console Maven Plugin There is not much documentation about how to use it on the Internet. The author, simplercity, took down their blog entry for how to use it. But I did find one post on stackoverflow on how to use it.
The current version of this plugin is 1.55. It can be found here. One issue that I encountered is that while most of the artifacts that are required for this plugin are on version 1.55 one of them, jetty-console-ajp-plugin, is on version 1.53. This caused a problem for me because when I had all the other plugins set to 1.55 there was a signer exception error I got when I tried to execute my war. I found the solution in this stackoverflow answer. The fix was to use only 1.53 version of all the plugins. There might be a better solution that allows you to use 1.55 with 1.53 ajp-plugin. Other than that the plugin worked great and I implore the author of Jetty Console Maven Plugin to either bring his blog post on how to use it back up or create new documentation for it.
To execute a standalone application in Java it doesn't need to be a war. A jar is fine enough. A war contains information about how a web archive/application should be deployer into a J2EE container. When you run it standalone this isn't necessary. The main method will be enough. You can have a look at maven shade plugin. It will help you build a runnable jar.
(As a sidenote - a runnable jar is a rather simple thing. The manifest file of the jar file needs to contain the key MainClass and that is it.)

How to automatically deploy maven project from eclipse to tomcat

See title. I would also like the project to redeploy after every change. I am new to this area so my knowledge isnt that good. I tried googling and searching here, but I can't find any answer.
thanks for any help
There are two plugins that combined together in Eclipse work quite well together to perform what you want:
M2E: M2Eclipse which handles everything related to Maven.
Eclipse Web Tool Platform (WTP): which handles everything Java EE related (Tomcat, JBoss, etc...)
For M2E to work properly with WTP, you need to add m2e-wtp. You may find several useful information as well as some good links here.
I would start from the Eclipse Java EE distribution (it includes already Eclipse-WTP) and then add M2E (either with their update site or through eclipse market place: look for M2E and M2E-WTP).
From there, you create a Web Project and you can run it on a Tomcat server. The first time you try to run you project on a server, you will install Tomcat and it will appear in view named "Server". Double click on the server to configure ports, automatic deployment etc...
You can easily deploy a webapp using the Cargo Tomcat plugin. Here's helpful articles on this topic:
Maven Tomcat Deployment using Cargo plugin.
Autodeployment with Maven, Tomcat, and Cargo.

How Do I Package and Deploy an Eclipse Java Application?

I have built a Java application that has some dependencies (~10). I would like to easily package this application up and deploy it as a single file to a CD or USB drive.
There doesn't seem to be any "nice" wizard to search the project, grab the dependencies and setup the classpath on the target computer. I have to do this manually.
Is there a better way? Something simple, easy and straight-forward. A link to a tutorial on this would be great.
Seems to me that this should be a built-in feature to eclipse. Deployment of a web application seems easy enough, but not a Java application.
Have a look at the Fat Jar Plug-In.
That's because desktop deployment isn't well defined.
You are heading into release issues which is a huge can of worms.
I assume you have some form of version control like SVN or git? If so check out maven with the release plugin and maven-assembly-plugin
It'll take a lot of work to setup, but once you get it going you'll be cross linking and deploying distribution packages in no time!
Plus you'll have access to the vast maven repos on the web right now

Which Maven GlassFish plugin to use?

I've been trying to integrate deploying java .war's in GlassFish V3 through Maven. While I have found a few plugins, none of them look to be very active:
Maven Glassfish Plugin
Eskato's Wordpress Blog on Maven
And I got the most information out of Eskato's Blog, it was written March 2008, so I don't know what the state of GlassFish Maven integration is, nor can I find a suitable plugin to work with. With the Maven GlassFish Plugin I have had some success, but it still doesn't work entirely well for all goals it says it supports, which makes some of the commands ineffective.
Has anyone else been able to integrate Glassfish V3 and Maven successfully? If so, what resources did you use to get it done?
Update: CARGO-491 has been fixed and I've updated my answer accordingly. To summarize, there are now basically three options:
Maven GlassFish Plugin
A first option would be to use the Maven GlassFish Plugin. This plugin allows to interact with a local or remote GlassFish install and the management of Glassfish domains and component deployments from within the Maven build lifecycle.
Maven Embedded GlassFish Plugin
The second option would be to use the Maven Embedded Glassfish Plugin. As stated by its name, this plugin doesn't rely on an existing install but uses an embedded GlassFish, running in the same JVM as the plugin. This plugin is extremely nice if you want to keep your build portable (anybody can get your POM and run a build involving GlassFish without having it installed) with almost the same features as a normal GlassFish install, except clustering of course (you can use a preconfigured domain.xml if you want). See Testing with the GlassFish Maven plugin and JavaDB Embedded for an example.
Maven Cargo Plugin
The work initiated by Kohsuke Kawagushi as been finally integrated in Cargo and, starting with Cargo 1.0.1, GlassFish 3.x is now supported. Using the Maven Cargo plugin is thus a third option. This would be interesting for builds that want to interact with containers in an agnostic way. But I'm not sure Cargo allows all the flexibility of the GlassFish specific plugin(s) (e.g. deployment of JMS resources, etc).
maven-glassfish-plugin and maven-embedded-glassfish-plugin both have their pros and cons. The main difference is that the latter works with an Embedded Glassfish instance, as indicated by its name, i.e. the server is running in the same VM as the plugin.
So you cannot use maven-embedded-glassfish-plugin to deploy your WAR to a standalone Glassfish server, you need maven-glassfish-plugin to do that.
The main problem I had with the maven-glassfish-plugin is the fact that its interaction with the Glassfish server is stateful - I could not find a way to use it such that my WAR would get deployed to the server in any case, no matter whether the previous build succeeded or not.
glassfish:deploy does not work if the WAR is deployed already. glassfish:redeploy does not work if the WAR is not deployed. And Maven has no if-else logic...
I've blogged about how to configure Maven Embedded GlassFish plugin to work correctly with GlassFish 4.0 until there's a new release of that plugin.
https://blogs.oracle.com/brunoborges/entry/glassfish_4_beta_and_maven
Also, it is possible to configure a datasource in the glassfish-resources.xml and have it working correctly.
https://blogs.oracle.com/brunoborges/entry/configure_datasources_for_maven_embedded
These are useful tips to anyone that want to run Java EE 7 projects with Maven and GlassFish 4
You can use this one :
http://www.hascode.com/2011/09/java-ee-6-development-using-the-maven-embedded-glassfish-plugin/
https://github.com/andrzejsliwa/glassfish-maven-plugin/wiki
http://cargo.codehaus.org/Maven2+plugin
I use the glassfish plugin on maven-glassfish-plugin.dev.java.net and did some code changes to support v3 now. I requested committer status and wait for acknowledgement. Hopefully I can commit my changes.

Categories

Resources