tag:blogger.com,1999:blog-135567212024-03-07T18:17:19.229+10:30The Buttso BlathersButtsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.comBlogger211125tag:blogger.com,1999:blog-13556721.post-76596427478693514232015-09-07T10:15:00.004+09:302015-09-07T10:15:44.470+09:30Solaris VM Templates for WebLogic Server 12.1.3A new set of VM Templates for Solaris have been made available on OTN. <br />
These templates provide a quick and easy way to spin up pre-built WebLogic Server 12.1.3 instances using either Solaris Zones or Oracle VM Server for Sparc. <br />
<br />
<a href="http://www.oracle.com/technetwork/server-storage/solaris11/downloads/solaris-vm-2621499.html">http://www.oracle.com/technetwork/server-storage/solaris11/downloads/solaris-vm-2621499.html</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiajZa4DZhH48oJwgQ8mSsPwNPP3NzRggpsMAj7y3fpVq1r0nkm_U-VZE45lxNc1QJw3ERSavnTbq7HqWl2QdpVhLb-TB2RasSjh1aHbM26McdvOah5eTbaeHymfRCgjL9Drm78/s1600/Screen+Shot+2015-09-06+at+17.41.56.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="348" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiajZa4DZhH48oJwgQ8mSsPwNPP3NzRggpsMAj7y3fpVq1r0nkm_U-VZE45lxNc1QJw3ERSavnTbq7HqWl2QdpVhLb-TB2RasSjh1aHbM26McdvOah5eTbaeHymfRCgjL9Drm78/s640/Screen+Shot+2015-09-06+at+17.41.56.png" width="640" /></a></div>
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-45250436297120140262015-08-14T09:18:00.000+09:302015-08-14T09:18:05.011+09:30WebLogic Server 12.1.3 Developer Zip - Update 3 PostedAn update has just been posted on OTN for the WebLogic Server 12.1.3 Developer Zip distribution.<br />
<br />
WebLogic Server 12.1.3 Developer Zip Update 3 is built with the fixes from the WebLogic Server 12.1.3.0.4 Patch Set Update, providing developers with access to the latest set of fixes available in the corresponding production release.<br />
<br />
See the download page for access to the update:<br />
<br />
<a href="http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html">http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html</a><br />
<br />
<a href="http://download.oracle.com/otn/nt/middleware/12c/wls/1213/wls1213_dev_update3.zip">http://download.oracle.com/otn/nt/middleware/12c/wls/1213/wls1213_dev_update3.zip</a> <br />
<br />
The Update 3 README provides details of what has been included:<br />
<br />
<a href="http://download.oracle.com/otn/nt/middleware/12c/wls/1213/README_WIN_UP3.txt">http://download.oracle.com/otn/nt/middleware/12c/wls/1213/README_WIN_UP3.txt</a> <br />
<br /><br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-48789899731675218312015-07-23T22:09:00.002+09:302015-07-23T22:09:37.990+09:30NetBeans 8.1 Remote Debugging with WebLogic Need to debug your application? With NetBeans 8.1 (dev) and WebLogic it's very easy to do.<br />
<br />
First start your WebLogic server in debug mode. The startup scripts generated for a domain provide an option to start the server in debug mode. <br />
<br />
To run in debug mode, set the environment variable "debugFlag" to a value of "true" and start the server.<br />
<br />
<pre class="prettyprint">$ export debugFlag="true"
$ ./startWebLogic.sh</pre>
<br />
This launches the server with a command line such as that shown below, which sets the standard Java debug properties:<br />
<pre class="prettyprint">Starting WLS with line:
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java -server -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8453,server=y,suspend=n -Djava.compiler=NONE -Xmx512m -Dweblogic.Name=myserver -Djava.security.policy=/tmp/dev_update2/wls12130/wlserver/server/lib/weblogic.policy -Xverify:none -Djava.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre/lib/endorsed:/tmp/dev_update2/wls12130/wlserver/../oracle_common/modules/endorsed -ea -da:com.bea... -da:javelin... -da:weblogic... -ea:com.bea.wli... -ea:com.bea.broker... -ea:com.bea.sbconsole... -Dwls.home=/tmp/dev_update2/wls12130/wlserver/server -Dweblogic.home=/tmp/dev_update2/wls12130/wlserver/server -Dweblogic.utils.cmm.lowertier.ServiceDisabled=true weblogic.Server</pre>
The console will display a message confirming the debug Java VM is using:
<br />
<pre class="prettyprint">Listening for transport dt_socket at address: 8453</pre>
<br />
Now on the NetBeans side, create a new Server entry for your WebLogic instance using the new Remote Domain option:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT6DgVhSjQR3TpS14CDUOOeFqeGw4bRwP9Og88DoBsAZb6Wygeq0FlRGMV2m3dqKVb6g5ontpfUrJgnKLAdWCxR-ncrx6tq9Mr-fnrO0QZvG0R2dRZL7o9oKU6OG5WQWvAwJQp/s1600/Screen+Shot+2015-07-23+at+21.47.37.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT6DgVhSjQR3TpS14CDUOOeFqeGw4bRwP9Og88DoBsAZb6Wygeq0FlRGMV2m3dqKVb6g5ontpfUrJgnKLAdWCxR-ncrx6tq9Mr-fnrO0QZvG0R2dRZL7o9oKU6OG5WQWvAwJQp/s400/Screen+Shot+2015-07-23+at+21.47.37.png" /></a></div>
<br />
Check the Server debug mode enabled option and specify the port (8453 by default):<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2oBP8zEgt2tVxIvhfGlAm4ed4wlhby1lfKHoA3kRJWKDIUVfQTMjlTCsSXddgBkdstjqxmeO4UHnzrDiTJ5p8aTJT9_vuwxDixmpkDTKB62-FpfEuy7UiuAw9DZK7TBchYGJQ/s1600/Screen+Shot+2015-07-23+at+21.48.50.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2oBP8zEgt2tVxIvhfGlAm4ed4wlhby1lfKHoA3kRJWKDIUVfQTMjlTCsSXddgBkdstjqxmeO4UHnzrDiTJ5p8aTJT9_vuwxDixmpkDTKB62-FpfEuy7UiuAw9DZK7TBchYGJQ/s400/Screen+Shot+2015-07-23+at+21.48.50.png" /> </a></div>
<div>
<br />
Now specify the new server as the destination to use to run the application:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXLAErM2BU56eeLWaQvJBjRuGFb4evutXXBDTsTckxKTsiFdG3bdZtl7SOhRaiV0iFRbSitFapwbJ6VKmab2tQVgEWKtOjyC959w-h3lcNgXdCGMPRKGQwOWFAToNIWByQQyAU/s1600/Screen+Shot+2015-07-23+at+21.55.32.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="224" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXLAErM2BU56eeLWaQvJBjRuGFb4evutXXBDTsTckxKTsiFdG3bdZtl7SOhRaiV0iFRbSitFapwbJ6VKmab2tQVgEWKtOjyC959w-h3lcNgXdCGMPRKGQwOWFAToNIWByQQyAU/s320/Screen+Shot+2015-07-23+at+21.55.32.png" width="320" /></a></div>
</div>
<div>
Now to debug your application, simply set a break point in your code and select the Debug option for the project:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpLSY64OOei6fSEP-8_GTgnO2Wh3Ty5JwmUxoKonxiqHjDvDWLgajaPuAlpuD4T2qyluLBxonhu-0HaoYGfFECpjpFvFArHUDmnAbJ1KMg1Eiet2Pk2zcTRjwIr4sw6hGUs8sC/s1600/Screen+Shot+2015-07-23+at+21.58.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpLSY64OOei6fSEP-8_GTgnO2Wh3Ty5JwmUxoKonxiqHjDvDWLgajaPuAlpuD4T2qyluLBxonhu-0HaoYGfFECpjpFvFArHUDmnAbJ1KMg1Eiet2Pk2zcTRjwIr4sw6hGUs8sC/s320/Screen+Shot+2015-07-23+at+21.58.14.png" width="217" /></a></div>
<br />
<br />
This will build and deploy the application to the WebLogic remotely then open the Debugger in the IDE and connect it automatically to the WebLogic debug port. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIIEzqEDAdyyQhORTA1LQ_6FdXrLA62cw5mdItCsE8j0kRaKPPms4CAa7mMjQbW-3McC6E7-zVj_GCQe3hC6JPVA-xTumKY8c6oVDVIpvn7Ma9wdRRVarrnQ1VdhQ8eOpb8Ize/s1600/Screen+Shot+2015-07-23+at+22.03.32.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="404" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIIEzqEDAdyyQhORTA1LQ_6FdXrLA62cw5mdItCsE8j0kRaKPPms4CAa7mMjQbW-3McC6E7-zVj_GCQe3hC6JPVA-xTumKY8c6oVDVIpvn7Ma9wdRRVarrnQ1VdhQ8eOpb8Ize/s640/Screen+Shot+2015-07-23+at+22.03.32.png" width="640" /></a></div>
From here you can use all the standard debug facilities to step through your code, view stacks, instance data and so forth.<br />
<br />
Debug away!<br />
<br />
<br />
<br />
<br />
</div>
Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-29129659331891990022015-07-22T09:45:00.002+09:302015-07-22T15:11:40.468+09:30NetBeans 8.1 Remote Deployment for WebLogic<b>Stoked</b> that NetBeans 8.1 will have support for deployment to remote WebLogic Server instances.<br />
<br />
http://wiki.netbeans.org/NewAndNoteworthyNB81#Remote_WebLogic<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://wiki.netbeans.org/wiki/images/4/4a/Weblogic_step1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://wiki.netbeans.org/wiki/images/4/4a/Weblogic_step1.png" height="268" width="400" /></a></div>
<br />
#lovethistoolButtsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-29558356259264762682015-04-09T10:50:00.001+09:302015-04-09T10:50:52.822+09:30Deploying applications remotely with WebLogic REST Management InterfaceWebLogic 12.1.3 provides a fully documented REST Management Interface that enables deployment and management operations to be performed using REST calls. <br />
<br />
The table of contents from the documentation lists the set of operations available:<br />
<ul>
<li><a href="http://docs.oracle.com/middleware/1213/wls/WLRMR/toc.htm">http://docs.oracle.com/middleware/1213/wls/WLRMR/toc.htm</a></li>
</ul>
To use the REST Management Interface, it first must be enabled for a domain. This can be done from the WebLogic Console.<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"><b>Domain > Configuration > General [Advanced] > Enable RESTful Management Services</b></span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs7L9p-NmkfmI8nqVSblQtiRqwP1MVEYGQ81pVrOg9muAeOCm87c_ptWz_BQhXGaXEW4aLack1RzaM4eJNThGmLvT_FafV-6mE0E116In3pBKMY-FoTdg9LgMecY0dgcuNbEAy/s1600/Screen+Shot+2015-04-09+at+10.05.52+am.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs7L9p-NmkfmI8nqVSblQtiRqwP1MVEYGQ81pVrOg9muAeOCm87c_ptWz_BQhXGaXEW4aLack1RzaM4eJNThGmLvT_FafV-6mE0E116In3pBKMY-FoTdg9LgMecY0dgcuNbEAy/s1600/Screen+Shot+2015-04-09+at+10.05.52+am.png" height="400" width="386" /></a></div>
<br />
<br />
To deploy an application to a remote server, the REST Management Interface provides the ability to upload an application archive and execute the deployment operation:<br />
<ul>
<li><a href="http://docs.oracle.com/middleware/1213/wls/WLRMR/management_wls_version_deployments_application.htm#weblogic_management_rest_wls_resources_deployment_applicationsresource_deployapplication_286308891">http://docs.oracle.com/middleware/1213/wls/WLRMR/management_wls_version_deployments_application.htm#weblogic_management_rest_wls_resources_deployment_applicationsresource_deployapplication_286308891</a></li>
</ul>
To perform this type of deployment operation a HTTP POST on the deployment URL is invoked specifying:<br />
<ol>
<li>The HTTP Header of <b>multipart/form-data</b>;</li>
<li>The application archive is supplied as form field <b>deployment</b>;</li>
<li>The deployment information specified using the form field <b>model</b> in which the application <b>name</b>, <b>targets</b> and other attributes are supplied;</li>
</ol>
Using curl this looks like the following:<br />
<br />
<pre class="prettyprint">$ curl \
--user weblogic:welcome1 \
-H X-Requested-By:TestForRest \
-H Accept:application/json \
-H Content-Type:multipart/form-data \
-F "model={
name: 'basicwebapp',
targets: [ 'AdminServer' ]
}" \
-F "deployment=@/tmp/basicwebapp.war" \
-X POST http://adc2101001.us.oracle.com:7001/management/wls/latest/deployments/application
</pre>
<br />
When this REST call is made with curl, the application archive specified as <b>@/tmp/basicwebapp.war</b> is uploaded as a binary file using the form field <b>deployment</b> and the configuration information supplied in the <b>model</b> form parameter used to define and perform the deployment.<br />
<br />
The response returned from the REST call contains a payload with the result of the operation that was performed.<br />
<br />
<pre class="prettyprint">{
"messages": [{
"message": "Deployed the application 'basicwebapp'.",
"severity": "SUCCESS"
}],
"links": [{
"rel": "job",
"uri": "http://adc2101001:7001/management/wls/latest/jobs/deployment/id/3"
}],
"item": {
"name": "ADTR-3",
"id": "3",
"type": "deployment",
"status": "completed",
"beginTime": 1428541581923,
"endTime": 1428541584150,
"targets": [{
"name": "AdminServer",
"type": "server",
"errors": [],
"status": "completed"
}],
"description": "[Deployer:149026]deploy application basicwebapp on AdminServer.",
"operation": "deploy",
"deploymentName": "basicwebapp"
}
}
</pre>
<br />
Further information about the deployment resource can be obtained using a further REST call, which provides links to operations that can be performed on the application, URLs to access the application, context-paths for registered servlets, runtime data and other useful information.<br />
<br />
<pre class="prettyprint">$ curl \
--user weblogic:welcome1 \
-H Accept:application/json \
http://adc2101001:7001/management/wls/latest/deployments/application/id/basicwebapp
</pre>
<br />
Which returns a response containing a payload with details of the deployment:<br />
<br />
<pre class="prettyprint">{
"links": [
{
"rel": "parent",
"uri": "http://adc2101001:7001/management/wls/latest/deployments/application"
},
{
"rel": "action",
"uri": "http://adc2101001:7001/management/wls/latest/deployments/application/id/basicwebapp/redeploy",
"title": "redeploy"
},
{
"rel": "action",
"uri": "http://adc2101001:7001/management/wls/latest/deployments/application/id/basicwebapp/update",
"title": "update"
},
{
"rel": "action",
"uri": "http://adc2101001:7001/management/wls/latest/deployments/application/id/basicwebapp/start",
"title": "start"
},
{
"rel": "action",
"uri": "http://adc2101001:7001/management/wls/latest/deployments/application/id/basicwebapp/stop",
"title": "stop"
},
{
"rel": "bindables",
"uri": "http://adc2101001:7001/management/wls/latest/deployments/application/id/basicwebapp/bindables"
}
],
"item": {
"name": "basicwebapp",
"state": "active",
"type": "application",
"displayName": "basicwebapp",
"targets": ["AdminServer"],
"planPath": "/scratch/sbutton/Oracle/Middleware/user_projects/domains/arq_domain/servers/AdminServer/upload/basicwebapp/plan/Plan.xml",
"urls": ["http://adc2101001:7001/basicwebapp"],
"openSessionsCurrentCount": 1,
"sessionsOpenedTotalCount": 1,
"servlets": [
{
"servletName": "JspServlet",
"contextPath": "/basicwebapp",
"aggregateMetrics": {
"executionTimeTotal": 0,
"invocationTotalCount": 0,
"reloadTotalCount": 0,
"executionTimeHigh": 0,
"executionTimeLow": 0
},
"servletMetrics": [{
"serverName": "AdminServer",
"executionTimeTotal": 0,
"invocationTotalCount": 0,
"reloadTotalCount": 0,
"executionTimeHigh": 0,
"executionTimeLow": 0
}]
},
{
"servletName": "Faces Servlet",
"contextPath": "/basicwebapp",
"aggregateMetrics": {
"executionTimeTotal": 22,
"invocationTotalCount": 1,
"reloadTotalCount": 1,
"executionTimeHigh": 22,
"executionTimeLow": 22
},
"servletMetrics": [{
"serverName": "AdminServer",
"executionTimeTotal": 22,
"invocationTotalCount": 1,
"reloadTotalCount": 1,
"executionTimeHigh": 22,
"executionTimeLow": 22
}]
},
{
"servletName": "FileServlet",
"contextPath": "/basicwebapp",
"aggregateMetrics": {
"executionTimeTotal": 0,
"invocationTotalCount": 0,
"reloadTotalCount": 0,
"executionTimeHigh": 0,
"executionTimeLow": 0
},
"servletMetrics": [{
"serverName": "AdminServer",
"executionTimeTotal": 0,
"invocationTotalCount": 0,
"reloadTotalCount": 0,
"executionTimeHigh": 0,
"executionTimeLow": 0
}]
}
],
"ejbs": [],
"deploymentPath": "servers/AdminServer/upload/basicwebapp/app/basicwebapp.war",
"applicationType": "war",
"health": {"state": "ok"}
}
} </pre>
<br/>
The documentation provides extensive coverage of the many resources and entity types that can be reached via the REST Management Interface.
<br/>
Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com1tag:blogger.com,1999:blog-13556721.post-14228401398198126862015-02-24T09:14:00.001+10:302015-02-24T09:14:37.034+10:30Fronting Oracle Maven Repository with Sonatype NexusThe <b>Sonatype</b> team have announced the release of <b>Nexus 2.1.1</b> which is a minor update that now works with the Oracle Maven Repository.<br />
<br />
I was going to write a bit up about it but Manfred Moser from Sonatype has already put together a blog and video on it:<br />
<blockquote class="tr_bq">
With the new <a href="https://support.sonatype.com/entries/87851808-Sonatype-Nexus-2-11-2-Release-Notes" target="_blank" title="Nexus 2.11.2 Release">Nexus 2.11.2 release</a> we are supporting the authentication mechanism used for the Oracle Maven repository in both <a href="http://www.sonatype.org/nexus/go/" target="_blank" title="Nexus OSS">Nexus OSS</a> and <a href="https://support.sonatype.com/entries/20673111-How-do-I-download-Nexus-Professional-" target="_blank" title="Nexus Pro">Nexus Pro</a>.
This allows you to proxy the repository in Nexus and makes the
components discoverable via browsing the index as well as searching for
components. </blockquote>
<blockquote class="tr_bq">
You will only need to set this up once in Nexus and all your
projects. Developers and CI servers get access to the components and
the need for any manual work disappears. On the Nexus side, the <a href="https://support.sonatype.com/entries/88177067-How-to-configure-a-proxy-repository-to-maven-oracle-com" target="_blank" title="Configuration changes">configuration changes</a> can be done easily as part of your upgrade to the new release. </blockquote>
<br />
Check it out @ <a href="http://www.sonatype.org/nexus/2015/02/19/using-the-oracle-maven-repository-with-nexus/">Using the Oracle Maven Repository with Nexus</a> <br />
<br />
<br /><br />
<br />
<br />
<br />
<br />
<br />
Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-20732166017709855122015-02-10T15:11:00.002+10:302015-02-10T15:14:28.085+10:30Fronting Oracle Maven Repository with Artifactory The JFrog team announced this week the release of <b>Artifactory 3.5.1</b>, which is a minor update that now works with the Oracle Maven Repository.<br />
<br />
<a href="http://www.jfrog.com/artifactory">http://www.jfrog.com/confluence/display/RTF/Artifactory+3.5.1</a><br />
<br />
I spent a little while yesterday having a look at it, working through the configuration of a remote repository and testing it with a maven project to see how it worked.<br />
<br />
Once I'd downloaded it and started it up -- much love for simple and obvious bin/*.sh scripts -- it was a very simple two step process:<br />
<br />
1. Since we live behind a firewall first add a proxy configuration to point at our proxy server.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKKewZDaJ3ji_iTo5Zb79zk4ewWDTUjU3pg0m6rr0sSkhGUhVGe716CFIubwfyX89C8rtSwCpLILMZQLMVDdboSt32211U9axqmbZxF_aJoWDtUz-LCgY6iIRGIl-m3t10oMqu/s1600/Screen+Shot+2015-02-10+at+2.20.06+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKKewZDaJ3ji_iTo5Zb79zk4ewWDTUjU3pg0m6rr0sSkhGUhVGe716CFIubwfyX89C8rtSwCpLILMZQLMVDdboSt32211U9axqmbZxF_aJoWDtUz-LCgY6iIRGIl-m3t10oMqu/s1600/Screen+Shot+2015-02-10+at+2.20.06+pm.png" height="252" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
2. Add a new remote repository and pointed it at the Oracle Maven Repository, specifying its URL and using my OTN credentials as username and password. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge8QZ49dVR9KccSyEyRY-jcqWCmerlUpOWKUyCmaEjYaF0jXv3X33rz-1TmJymKy3dUB6qXBtoyKrfHrYTOotijw6TYrCZS24tna55zdAzM_BS5axxPD9QDyINxyDQ3fuNhtVP/s1600/Screen+Shot+2015-02-10+at+2.21.44+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEge8QZ49dVR9KccSyEyRY-jcqWCmerlUpOWKUyCmaEjYaF0jXv3X33rz-1TmJymKy3dUB6qXBtoyKrfHrYTOotijw6TYrCZS24tna55zdAzM_BS5axxPD9QDyINxyDQ3fuNhtVP/s1600/Screen+Shot+2015-02-10+at+2.21.44+pm.png" height="315" width="400" /></a></div>
<br />
The Artifactory 3.5.1 documentation stated that the <b>Advanced Settings</b> ><b> Lenient host authentication</b> and <b>Enable cookie management</b> options must be checked when accessing the Oracle Maven Repository. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFnBuGnzmI52rb5G79lJNr0GBQKQWc8E5GJy9RETMp0uqnzn_QNQ0e6fvWH36aCgxFBte9Fl-9x8818VgYBQTdoyGD8ryZbwJ1LNXpLT93fQDucA8TFQFQVMCIHILqY1LO3bLe/s1600/Screen+Shot+2015-02-10+at+2.23.06+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFnBuGnzmI52rb5G79lJNr0GBQKQWc8E5GJy9RETMp0uqnzn_QNQ0e6fvWH36aCgxFBte9Fl-9x8818VgYBQTdoyGD8ryZbwJ1LNXpLT93fQDucA8TFQFQVMCIHILqY1LO3bLe/s1600/Screen+Shot+2015-02-10+at+2.23.06+pm.png" height="366" width="400" /></a></div>
<br />
The <b>Test</b> button is handy to verify the server settings have been entered correctly.<br />
<br />
3. Use the <b>Home</b> tab > <b>Client Settings</b> > <b>Maven Settings</b> link to generate and save a settings.xml file that uses the artifactory server.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-FaGfrTJX_wYZxI1zKk02Q2-f4H-u80JiJevRhYxboiiUMO-gbWz2_7xSBgUWn_DChGVbR5AsXejJLmlDJOy070Dr13WMsS9Lhx03sLPpOkHD8qQAT1QpAwnwAkurrSdNcszc/s1600/Screen+Shot+2015-02-10+at+2.40.01+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-FaGfrTJX_wYZxI1zKk02Q2-f4H-u80JiJevRhYxboiiUMO-gbWz2_7xSBgUWn_DChGVbR5AsXejJLmlDJOy070Dr13WMsS9Lhx03sLPpOkHD8qQAT1QpAwnwAkurrSdNcszc/s1600/Screen+Shot+2015-02-10+at+2.40.01+pm.png" height="400" width="366" /></a></div>
<br />
<br />
With the repository running, configured and the settings.xml saved, its then possible to try it out with an existing maven project such as <a href="https://github.com/buttso/weblogic-with-arquillian">https://github.com/buttso/weblogic-with-arquillian</a>.<br />
<br />
I also nuked my local repository to force/verify that the dependencies were fetched through the specified Artifactory server.<br />
<br />
<pre class="prettyprint">$ rm -fr ~/.m2/repository/com/oracle
$ mvn -s artifactory-settings.xml test
</pre>
<br />
Viewing the output of the mvn process and the running Artifactory server you can see that maven is downloading dependencies from http://localhost:8081/artifactory and correspondingly Artifactory is downloading the requested artifact from https://maven.oracle.com.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCHaKqYjxqH1oGeJ8gMY6ENyp_EP-cFvdAop3h1qezS8yvf-WPSt9QML5OQ9fYdRF_uMOKIfL-sF_JUiYJsE6AcT5tawaR7_fKqzxsEb2LyKWVaD20eZ1EoRB_RjN3QGEG8-SA/s1600/Screen+Shot+2015-02-10+at+2.38.00+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCHaKqYjxqH1oGeJ8gMY6ENyp_EP-cFvdAop3h1qezS8yvf-WPSt9QML5OQ9fYdRF_uMOKIfL-sF_JUiYJsE6AcT5tawaR7_fKqzxsEb2LyKWVaD20eZ1EoRB_RjN3QGEG8-SA/s1600/Screen+Shot+2015-02-10+at+2.38.00+pm.png" height="376" width="640" /></a></div>
<br />
Once the maven process has completed and all the requested artifacts downloaded, Artifactory will have cached them locally for future use.<br />
<br />
Using the <b>Search</b> functionality of the Artifactory Web UI you can search for weblogic artifacts.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWc7wqSD1VCyFihheG4BzxtnUc3jiAw2RvjxxNz-riHPYUC0oqdB6PaZA6cEcZs22A99lrlYuo4_957xQYV5emjAIgq8ffUJxXotOrGZWTzJktVqrv0mJEGivBiDY6odOaImpA/s1600/Screen+Shot+2015-02-10+at+2.52.52+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWc7wqSD1VCyFihheG4BzxtnUc3jiAw2RvjxxNz-riHPYUC0oqdB6PaZA6cEcZs22A99lrlYuo4_957xQYV5emjAIgq8ffUJxXotOrGZWTzJktVqrv0mJEGivBiDY6odOaImpA/s1600/Screen+Shot+2015-02-10+at+2.52.52+pm.png" height="450" width="640" /></a></div>
<br />
Using the <b>Repository Browser</b> functionality of the Artifactory Web UI you can view and navigate around the contents of the remote Oracle Maven Repository.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfBBJmm_NoTuNCghBlhGw2I8YcN2wSqM8Kwwg1DBV3v5Q4oyNyM6S0h58Fx7VsO_WZmQbc_EJGZYt8_E4BFaCY6bz6WQmDlbjBGdpxckcsDXkHDzJdzpH2izf7SbmLCqwnhNqQ/s1600/Screen+Shot+2015-02-10+at+2.52.34+pm.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfBBJmm_NoTuNCghBlhGw2I8YcN2wSqM8Kwwg1DBV3v5Q4oyNyM6S0h58Fx7VsO_WZmQbc_EJGZYt8_E4BFaCY6bz6WQmDlbjBGdpxckcsDXkHDzJdzpH2izf7SbmLCqwnhNqQ/s1600/Screen+Shot+2015-02-10+at+2.52.34+pm.png" height="449" width="640" /></a>Nice <b>JFrog > Artifactory </b>team - thanks for the quick support of our repository.<br />
<span style="background-color: #eeeeee;"></span><br />
<blockquote class="tr_bq">
<span style="background-color: #3d85c6;"><span style="color: #0b5394;"><span style="background-color: #f3f3f3;">One further thing I'd look at doing is enabling the <b>Configure Passwords Encryption</b> option in the <b>Security</b> settings to encrypt your OTN password, so that it's not stored in cleartext in the <b>etc/artifactory.config.latest.xml</b> file.</span><span style="background-color: #6fa8dc;"></span></span></span></blockquote>
<br />
<br />
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-15236315018006221992015-02-09T12:24:00.002+10:302015-02-10T08:48:17.342+10:30Oracle Maven Repository - Viewing Contents in EclipseWith the Oracle Maven Repository now accessible one way to have explore its contents is to use the Maven Repositories viewer feature available in most development tools. I've seen the repository contents displayed easily in NetBeans so I decided to take a look at what it looks like in Eclipse as well.<br />
<br />
I had to make a few minor setting changes to get it to work so decided to document them here. If you've gotten it to work with less setting changes, let me know!<br />
<br />
As initial setup, I configured my local maven environment to support access to the Oracle Maven Repository. This is documented here <a href="https://maven.oracle.com/doc.html">https://maven.oracle.com/doc.html</a>. I also installed maven-3.2.5 that includes the updated Wagon module that supports authentication.<br />
<br />
Next I downloaded and used the new network installer that the
Oracle Eclipse team has published on OTN to install the latest version of Oracle Enterprise Pack for Eclipse. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcXDK04Ocjxsoj0rq8x_1MmmipD95kS8QYkh25vllt20nqZ6rUFS0PCR2HykzjH0TZScU4ruQYGwjaIgMeqc9uNaFBXTii14I-iELEZD7pTZx6NdjePfGVHp4VVe76z_LLZACq/s1600/Screen+Shot+2015-02-09+at+10.18.03+am.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcXDK04Ocjxsoj0rq8x_1MmmipD95kS8QYkh25vllt20nqZ6rUFS0PCR2HykzjH0TZScU4ruQYGwjaIgMeqc9uNaFBXTii14I-iELEZD7pTZx6NdjePfGVHp4VVe76z_LLZACq/s1600/Screen+Shot+2015-02-09+at+10.18.03+am.png" height="230" width="400" /></a></div>
<br />
<br />
This network installer lets developers select
the version of Eclipse to install and the set of Oracle extensions -- Weblogic, GlassFish and other stuff -- to add in to it.<br />
<br />
Once Eclipse is installed, you can add the Maven Repository viewer by selecting <b>Window</b> > <b>Show View</b> > <b>Other</b> > <b>Maven Repositories</b> from the Eclipse toolbar.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVO9-8VSgEXxFakQ2f2z05NRWaHaLM5fjOT8JpNj0pX8Wkwl27OOGGsKCeX3ZDiyQIos7wV6acLWt4VaWGMmsggV4Tr2YxXtLjJ4uctL34PgXvTnrtspdPUAwhgTqrACDN05UZ/s1600/Screen+Shot+2015-02-09+at+10.31.32+am.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVO9-8VSgEXxFakQ2f2z05NRWaHaLM5fjOT8JpNj0pX8Wkwl27OOGGsKCeX3ZDiyQIos7wV6acLWt4VaWGMmsggV4Tr2YxXtLjJ4uctL34PgXvTnrtspdPUAwhgTqrACDN05UZ/s1600/Screen+Shot+2015-02-09+at+10.31.32+am.png" height="400" width="293" /></a></div>
<br />
<br />
I also added a <b>Console</b> > <b>Maven</b> viewer to see what was happening under the covers and arranged them so they were visible at the same time:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT5fJ1xMNaNtjInzVf6yINQvXYzQm-BYueNYL-5Armj5I3LPUyfutvUYsXLvjyMtkZipTA0NGhvJ-_75TrF-29LOdhRDZK0GjxwHRD3t-xDoIQqbg9sEpJA8jUU1A-1eEy9_BL/s1600/Screen+Shot+2015-02-09+at+11.24.31+am.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT5fJ1xMNaNtjInzVf6yINQvXYzQm-BYueNYL-5Armj5I3LPUyfutvUYsXLvjyMtkZipTA0NGhvJ-_75TrF-29LOdhRDZK0GjxwHRD3t-xDoIQqbg9sEpJA8jUU1A-1eEy9_BL/s1600/Screen+Shot+2015-02-09+at+11.24.31+am.png" height="233" width="640" /></a></div>
<br />
With the Maven views ready to go, expand the <b>Global Repositories</b> node. This will show Maven Central (any other repositories you may have configured) and the Oracle Maven Repository if you have configured it correctly in the settings.xml file.<br />
<br />
The initial state of the Oracle Maven Repository doesn't show any contents indicating that its index hasn't been downloaded to display.<br />
<br />
Right mouse clicking on it and selecting the <b>Rebuild Index</b> option causes an error to be shown in the console output indicating that the index could not be accessed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdfU5ldpZErmDDiFCjcVbzdFxmxr-dv8tvzP0Nxxykqd3GDS1RWoZvv4WAyRiQC-XyFak83-YgqK97yi_-HIFplgEGpeGhAlZVUZkUm0r26F1IAayraaXPLX_F_HmjoWIJZgLO/s1600/Screen+Shot+2015-02-09+at+11.31.57+am.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdfU5ldpZErmDDiFCjcVbzdFxmxr-dv8tvzP0Nxxykqd3GDS1RWoZvv4WAyRiQC-XyFak83-YgqK97yi_-HIFplgEGpeGhAlZVUZkUm0r26F1IAayraaXPLX_F_HmjoWIJZgLO/s1600/Screen+Shot+2015-02-09+at+11.31.57+am.png" height="218" width="640" /></a></div>
<br />
To get it to work, I made the following changes to my environment. <br />
<h4>
Configure Eclipse to Use Maven 3.2.5</h4>
Using the <b>Eclipse</b> > <b>Preferences</b> > <b>Maven</b> > <b>Installation</b> dialog, configure Eclipse to use Maven 3.2.5. This is preferred version of Maven to use to access the Oracle Maven Repository since it automatically includes the necessary version of the Wagon HTTP module that supports the required authentication configuration and request flow.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTVukXUZ04uNHBzVh0jbyNQ6hlUPRQFwpUJDGQe68NhOwR5i2Pp1XJc7A_zmXEz0pVwZhOfrPsYkQwRl9Z5Dj-9Yr1u3MF48IdBED_-n5VSWWQ0KBzkPVTDFGgsh-SWl-ueD5-/s1600/Screen+Shot+2015-02-09+at+11.48.10+am.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTVukXUZ04uNHBzVh0jbyNQ6hlUPRQFwpUJDGQe68NhOwR5i2Pp1XJc7A_zmXEz0pVwZhOfrPsYkQwRl9Z5Dj-9Yr1u3MF48IdBED_-n5VSWWQ0KBzkPVTDFGgsh-SWl-ueD5-/s1600/Screen+Shot+2015-02-09+at+11.48.10+am.png" height="499" width="640" /></a></div>
<br />
<h4>
Configure Proxy Settings in Maven Settings File </h4>
<i>** If you don't need a proxy to access the Internet then step won't be needed **</i><br />
<i> </i> <br />
If you sit behind a firewall and need to use a proxy server to access public repositories then you need to configure a proxy setting inside the maven settings file.<br />
<br />
Interestingly for command line maven use and NetBeans a single proxy configuration in settings.xml was enough to allow the Oracle Maven Repository to be successfully accesses and its index and artifacts used.<br />
<br />
<script src="https://gist.github.com/buttso/a4455d98b7e2c03c623c.js"></script>
However with Eclipse, this setting alone didn't allow the Oracle Maven Repository to be accessed. Looking at the repository URL for the Oracle Maven Repository you can see ity's HTTPS based -- https://maven.oracle.com and it appears for Eclipse that a specific HTTPS based proxy setting is required for Eclipse to access HTTPS based repositories.<br />
<br />
<script src="https://gist.github.com/buttso/ec3f4481139aa3a73979.js"></script>
<br />
<h4>
Rebuild Index Success</h4>
With the settings in place, the Rebuild Index operation succeeds and the contents of the Oracle Maven Repository are displayed in the repository viewer.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQk17Uf3Vr3KK_As_iOcIeZ5sDilW_6MgF9St0MYoB8SqlOF34UJ4RULPmcKQJavuwEst88eijZ2__d0b8eKnvqpt167-ynWLqqEfp8R3zonxyJJphFXO7KCvsEtb8mNiUrEnu/s1600/Screen+Shot+2015-02-09+at+12.11.29+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQk17Uf3Vr3KK_As_iOcIeZ5sDilW_6MgF9St0MYoB8SqlOF34UJ4RULPmcKQJavuwEst88eijZ2__d0b8eKnvqpt167-ynWLqqEfp8R3zonxyJJphFXO7KCvsEtb8mNiUrEnu/s1600/Screen+Shot+2015-02-09+at+12.11.29+pm.png" height="216" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPOMsMrqIj6gXYkCwd_0uxWeekSZ1qicksakpnuF0mvatGiFnSXPCIDIWXzji-B8ABZyqAyyLCFTpUTYmHM2c_OdbSYffgpdpMyAzncGfxYSabRINgJJOaLrXzWy5z9wqiofyz/s1600/Screen+Shot+2015-02-09+at+12.23.18+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPOMsMrqIj6gXYkCwd_0uxWeekSZ1qicksakpnuF0mvatGiFnSXPCIDIWXzji-B8ABZyqAyyLCFTpUTYmHM2c_OdbSYffgpdpMyAzncGfxYSabRINgJJOaLrXzWy5z9wqiofyz/s1600/Screen+Shot+2015-02-09+at+12.23.18+pm.png" height="395" width="400" /></a></div>
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-48430944021520360392015-02-04T08:48:00.000+10:302015-02-04T08:48:10.426+10:30Bare-Bones Example of Using WebLogic and ArquillianThe <a href="http://arquillian.org/" target="_blank">Arquillian</a> project is proving to be very popular for testing code and applications. It's particularly useful for Java EE projects since it allows for in-container testing to be performed, enabling unit tests to use dependency injection and all the common services provided by the Java EE platform.<br />
<br />
Arquillian uses the concept of container adapters to allow it to execute test code with a specific test environment. For the Java EE area, most of the Java EE implementations have an adapter than can be used to perform the deployment of the archive under test and to execute and report on the results of the unit tests. <br />
<blockquote class="tr_bq">
<i>A handy way to see all the WebLogic Server related content on the Arquillian blog is this URL: <a href="http://arquillian.org/blog/tags/wls/">http://arquillian.org/blog/tags/wls/</a></i></blockquote>
For WebLogic Server the current set of adapters are listed here: <a href="http://arquillian.org/blog/2015/01/09/arquillian-container-wls-1-0-0-Alpha3/">http://arquillian.org/blog/2015/01/09/arquillian-container-wls-1-0-0-Alpha3/</a><br />
<br />
There are multiple adapters available for use. Some of them are historical and some are for use with older versions of WebLogic Server (10.3). <br />
<blockquote class="tr_bq">
<i>We are actively working with the Arquillian team on finalizing the name, version and status of a WebLogic Server adapter.</i></blockquote>
The preferred adapter set from the WebLogic Server perspective are these:<br />
<br />
<ul>
<li><a href="http://arquillian.org/modules/arquillian-wls-remote-12.1.2-container-adapter/" target="_blank">org.jboss.arquillian.container » arquillian-wls-remote-12.1.2</a></li>
<li><a href="http://arquillian.org/modules/arquillian-wls-managed-12.1.2-container-adapter/" target="_blank">org.jboss.arquillian.container » arquillian-wls-managed-12.1.2 </a></li>
</ul>
<br />
These adapters utilize the WebLogic Server JMX API to perform their tasks and are the adapters used internally by the development teams when working with Arquillian. They have been tested to work with WebLogic Server [12.1.1, 12.1.2, 12.1.3]. We also have been using them internally with the 12.2.1 version under development to run the CDI TCK and other tests.<br />
<br />
To demonstrate WebLogic Server working with Arquillian a bare-bones example is available on GitHub here: <a href="https://github.com/buttso/weblogic-with-arquillian">https://github.com/buttso/weblogic-with-arquillian</a><br />
<br />
This example has the most basic configuration you can use to employ
Arquillian with a Maven project to deploy and execute tests using
WebLogic Server 12.1.3.<br />
<br />
The README.md file in the project contains more details and a longer description. In summary though:<br />
<br />
1. The first step is to add the Arquillian related dependencies in the Maven pom.xml:<br />
<br />
<script src="https://gist.github.com/buttso/e13a10032b84a2b784f2.js"></script>
2. The next step is to create an arquillian.xml file that the container adapter uses to connect to the remote server that is being used as the server to run the tests:<br />
<br />
<script src="https://gist.github.com/buttso/8183ec7245855f95fa8a.js"></script>
3. The last step is to create a unit test which is run with Arquillian. The unit test is responsible for implementing the @Deployment method which constructs an archive to deploy that contains the code to be tested. The unit test then provides @Test methods in which the deployment is tested to verify its behaviour:<br />
<br />
<script src="https://gist.github.com/buttso/916e1fe2b198e3202be3.js"></script>
<br />
Executing the unit tests, with the associated archive creation and deployment to the server is performed using the maven test goal:<br />
<br />
<script src="https://gist.github.com/buttso/5444d7e2254b41f7c6dc.js"></script>
<br />
The tests can be executed directly from IDEs such as NetBeans and Eclipse using the Run Test features:<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6UiKhRPtwQgEgx9AMDUCWyXTOqVxsJVGHKm_ttX_T0YuaSBitgMpztnOdaUxx_et_WRUlOqnC718YryqyTWZuI9Co6PpVlNNdF2QuU_RPhrlfzlCOytG1njXbTrv_2PPl0rMv/s1600/Screen+Shot+2015-02-03+at+10.25.36+am.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6UiKhRPtwQgEgx9AMDUCWyXTOqVxsJVGHKm_ttX_T0YuaSBitgMpztnOdaUxx_et_WRUlOqnC718YryqyTWZuI9Co6PpVlNNdF2QuU_RPhrlfzlCOytG1njXbTrv_2PPl0rMv/s1600/Screen+Shot+2015-02-03+at+10.25.36+am.png" height="406" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Executing Tests using NetBeans</td></tr>
</tbody></table>
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-54289183468825308562015-02-03T17:42:00.001+10:302015-02-03T22:34:45.772+10:30Social Coding Resolves JAX-RS and CDI Producer Problem The inimitable Bruno Borges picked up tweet earlier today commenting on a problem using @Produces with non-CDI libraries with WebLogic Server 12.1.3.<br />
<br />
The tweeter put his example up on a github repository to share - quite a nice example of using JAX-RS, CDI integration and of using Arquillian to verify it works correctly. Ticked a couple of boxes for what I've been looking at lately<br />
<br />
Forking his project to have a look at it locally:<br />
<br />
<a href="https://github.com/buttso/weblogic-producers">https://github.com/buttso/weblogic-producers</a> <br />
<br />
Turns out that the issue was quite a simple and common one - a missing
reference to the jax-rs:2.0 shared-library that is needed to use JAX-RS
2.0 on WebLogic Server 12.1.3. Needs a weblogic.xml to reference that library.<br />
<br />
I made the changes in a local branch and tested it again:<br />
<br />
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">[INFO] ------------------------------------------------------------------------<br />[INFO] Reactor Summary:<br />[INFO] <br />[INFO] producers .......................................... SUCCESS [ 0.002 s]<br />[INFO] bean ............................................... SUCCESS [ 0.686 s]<br />[INFO] web ................................................ SUCCESS [ 7.795 s]<br />[INFO] ------------------------------------------------------------------------<br />[INFO] BUILD SUCCESS<br />[INFO] ------------------------------------------------------------------------</span></span><br />
<br />With the tests now passing, pushed the branch to my fork and sent Kuba a pull request to have a look at the changes I made:<br />
<br />
<a href="https://github.com/buttso/weblogic-producers/tree/steve_work">https://github.com/buttso/weblogic-producers/tree/steve_work</a><br />
<br />
I now just hope it works in his environment too :-)<br />
<br />
The GitHub model is pretty magical really.Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-15594035126731862062015-02-02T14:05:00.002+10:302015-02-02T14:09:01.801+10:30Using the WebLogic Embedded EJB ContainerThe WebLogic Server 12.1.3 EJB Developers Guide was recently updated to note that the embedded EJB container can be used by adding a reference to weblogic.jar to the CLASSPATH when the EJB client is being executed.<br />
<br />
<a href="https://docs.oracle.com/middleware/1213/wls/EJBAD/embedejb.htm#EJBAD1403" target="_blank">https://docs.oracle.com/middleware/1213/wls/EJBAD/embedejb.htm#EJBAD1403</a><br />
<br />
This is very convenient since it enables the WebLogic Server embedded EJB container to used by simply adding weblogic.jar to the classpath when running the client:<br />
<br />
<script src="https://gist.github.com/buttso/118a35d17b4705a36075.js"></script>
Or for example if you are developing unit tests using JUnit and running them from a maven project, you can configure the maven-surefire-plugin to use WebLogic Server to run the EJB test code in its embedded EJB container:<br />
<br />
<script src="https://gist.github.com/buttso/70ff35b60531766554ad.js"></script>
A fully working example of using this is available in this GitHub repository:<br/>
<br/>
<b><a href="https://github.com/buttso/weblogic-embedded-ejb">https://github.com/buttso/weblogic-embedded-ejb</a></b><br />
<br />
For more information have a look at the repository and check out the example.
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-90583119993805998252015-01-30T16:35:00.002+10:302015-01-30T17:04:58.164+10:30WebLogic Maven Plugin - Simplest ExampleI've seen a question or two in recent days on how to configure the weblogic maven plugin.<br />
<br />
The official <a href="https://docs.oracle.com/middleware/1213/wls/WLPRG/maven.htm#WLPRG587" target="_blank">documentation</a> is extensive ... but could be considered <b>TL;DR</b> for a quick bootstrapping on how to use it.<br />
<br />
As a late friday afternoon exercise I just pushed out an example of a very simple project that uses the weblogic-maven-plugin to deploy a web module. It's almost the simplest configuration that can be done of the plugin to perform deployment related operations of a project/module:<br />
<br />
<a href="https://github.com/buttso/weblogic-maven-plugin">https://github.com/buttso/weblogic-maven-plugin</a><br />
<br />
This relies on the presence of either a local/corporate repository that contains the set of weblogic artefacts and plugins - OR - you configure and use the <a href="https://maven.oracle.com/" target="_blank">Oracle Maven Repository </a>instead. <br />
<br />
Example pom.xml<br />
<br />
<script src="https://gist.github.com/buttso/db49ba0a177f06601d79.js"></script>Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-74694601814609533502015-01-30T10:53:00.002+10:302015-01-30T11:20:57.307+10:30Updated WebLogic Server 12.1.3 Developer Zip DistributionWe've just pushed out an update to the WebLogic Server 12.1.3 Developer Zip distribution containing the bug fixes from a recent PSU (patch set update).<br />
<br />
This is great for developers since it maintains the high quality of the developer zip distribution and the convenience it provides - avoids reverting to the generic installer to then enable the application of patch set updates. For development use only.<br />
<br />
Download it from OTN:<br />
<br />
<a href="http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html" target="_blank">http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html</a><br />
<br />
Check out the readme for the list of bug fixes:<br />
<br />
<a href="http://download.oracle.com/otn/nt/middleware/12c/wls/1213/README_WIN_UP1.txt">http://download.oracle.com/otn/nt/middleware/12c/wls/1213/README_WIN_UP1.txt</a>Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-45632085022222747782015-01-29T10:09:00.001+10:302015-02-12T09:50:45.387+10:30Oracle Maven Repository - Rolling News<h3>
<span style="color: #0b5394;">Oracle Maven Repository Is Live</span> </h3>
<h3>
</h3>
The Oracle Maven Repository is live and available for public access to the public APIs, libraries, utilities and archetypes that are shipped as part of the Oracle WebLogic Server 12.1.2 and 12.1.3 releases, including corresponding Coherence versions.<br />
<br />
<span style="font-size: x-small;">** The repository also publishes the same from the ADF, SOA, OSB and other Fusion Middleware options.</span><br />
<br />
<b>Oracle Maven Repository</b> <a href="http://maven.oracle.com/">http://maven.oracle.com</a><br />
<br />
<b>Using the Oracle Maven Repository</b> <a href="https://maven.oracle.com/doc.html">https://maven.oracle.com/doc.html</a><br />
<h3>
<span style="color: #0b5394;"> </span></h3>
<h3>
<span style="color: #0b5394;">Rolling News</span><b> </b></h3>
<h3>
<b> </b><b> </b></h3>
<b>Oracle Maven Repository is Live</b><br />
<br />
<a href="https://redstack.wordpress.com/2015/01/14/happy-new-year-happy-new-oracle-maven-repository">https://redstack.wordpress.com/2015/01/14/happy-new-year-happy-new-oracle-maven-repository</a><br />
<br />
<b>WebLogic Server and Oracle Maven Repository</b><br />
<br />
<a href="https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle" target="_blank">https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle </a><br />
<br />
<b>Oracle Maven Repository Index Available</b><br />
<br />
<a href="https://redstack.wordpress.com/2015/01/23/oracle-maven-repository-index-now-available-more-to-come/" target="_blank">https://redstack.wordpress.com/2015/01/23/oracle-maven-repository-index-now-available-more-to-come/</a><br />
<br />
<a href="https://blogs.oracle.com/WebLogicServer/entry/oracle_maven_repository_index_now">https://blogs.oracle.com/WebLogicServer/entry/oracle_maven_repository_index_now</a><br />
<br />
<h4>
JFrog Artifactory Supports Oracle Maven Repository</h4>
<a href="http://www.jfrog.com/confluence/display/RTF/Artifactory+3.5.1">http://www.jfrog.com/confluence/display/RTF/Artifactory+3.5.1</a><br />
<br />
<a href="http://buttso.blogspot.com.au/2015/02/fronting-oracle-maven-repository-with.html">http://buttso.blogspot.com.au/2015/02/fronting-oracle-maven-repository-with.html</a> <br />
<br />
<h4>
Sonatype Nexus Supports Oracle Maven Repository</h4>
<a href="https://github.com/archenroot/nexus-oss/releases/tag/nexus-2.11.2-01">https://github.com/archenroot/nexus-oss/releases/tag/nexus-2.11.2-01</a> <br />
<br />
<a href="https://issues.sonatype.org/browse/NEXUS/fixforversion/14525/?selectedTab=com.atlassian.jira.jira-projects-plugin:version-summary-panel">https://issues.sonatype.org/browse/NEXUS/fixforversion/14525/?selectedTab=com.atlassian.jira.jira-projects-plugin:version-summary-panel</a><br />
<br />
<br />
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-17212917025115946712015-01-28T09:57:00.002+10:302015-01-28T09:57:24.496+10:30Updating a GitHub forked repositoryMostly a reminder to self but thought I'd post the link in case anyone else is looking for this. More pointers the merrier.<br />
<br />
Simple, straight forward steps to synchronise a forked repository with its upstream repository and keep it up to date.<br />
<br />
<a href="https://help.github.com/articles/syncing-a-fork">https://help.github.com/articles/syncing-a-fork</a>
<br />
<blockquote class="tr_bq">
<h2>
<span style="color: #3d85c6;">Syncing a fork</span></h2>
<div class="intro">
<span style="color: #3d85c6;">Sync a fork of a repository to keep it up-to-date with the upstream repository.</span><br />
<span style="color: #3d85c6;"> ... </span></div>
</blockquote>
Following these simple steps enables a forked repository to be easily and regularly updated with changes from the upstream repository. <br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEt-u-yOmObTwsCCz62nIDjG4sQlavK3VBfOvVC3_TVQ1VS-R-zKBhP9Nlj1pOkfq2ZNX_aGSyBjlc6AkyHUl4r9caC7RgUynR0_MHlN1msH4LncRTsJiPvA9IvF8Fr7R15EPD/s1600/Screen+Shot+2015-01-28+at+9.50.33+am.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEt-u-yOmObTwsCCz62nIDjG4sQlavK3VBfOvVC3_TVQ1VS-R-zKBhP9Nlj1pOkfq2ZNX_aGSyBjlc6AkyHUl4r9caC7RgUynR0_MHlN1msH4LncRTsJiPvA9IvF8Fr7R15EPD/s1600/Screen+Shot+2015-01-28+at+9.50.33+am.png" height="323" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Up-to-date fork of the weblogic-docker repository</td></tr>
</tbody></table>
Take care to read the final tip in the guide that notes that the steps only update a local copy - the fetch and merge changes still need to be pushed back to the GitHub remote repository. <br />
<blockquote class="tr_bq">
<span style="color: #0b5394;"><strong>Tip</strong>: Syncing your fork only updates your local copy of the repository. To update your fork on GitHub, you must <a href="https://help.github.com/articles/pushing-to-a-remote">push your changes</a>.</span></blockquote>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-86722269539132590412015-01-13T14:47:00.004+10:302015-01-13T14:47:24.218+10:30Oracle Maven Repository is Live with WebLogic Server Artifacts<div style="text-align: center;">
<span style="color: red;"><span style="background-color: red;"><span style="background-color: white;"><span style="font-size: large;"><b>Oracle Maven Repository</b> </span></span></span></span></div>
<br />
<b>Very</b>. <b>Exciting</b>. <b>News</b>.
<br />
<br />
The <b>Oracle Maven Repository</b> has just gone live and is now available for public access, loaded with WebLogic Server artifacts from the 12.1.2 and 12.1.3 releases. <br />
<br />
Want free and easy access to WebLogic Server APIs, libraries and plugins - just have at it!<br />
<br />
<a href="http://maven.oracle.com/">http://maven.oracle.com</a><br />
<br />
<a href="https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle">https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle</a><br />
<br />
<iframe height="400" src="https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle" width="600"></iframe>Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-52633285114618389902014-12-11T13:28:00.003+10:302014-12-11T13:28:35.336+10:30Exploring DevOps with Chef and WebLogic ServerI'm about to embark on a journey that explores the use of WebLogic Server within a DevOps regime. My first port of call for this journey will be using Chef. <br />
<br />
A loose travel itinerary is: <br />
<ul>
<li>Setting up an environment to explore the basic operations of Chef - using the Chef Development Kit (ChefDK)</li>
<li>Exploring the basics of how Chef works to install Java and WebLogic Server on a single node</li>
<li>Installing and examining some of the existing cookbooks that are available for Java and WebLogic Server</li>
<li>Extending the environment to provision multiple nodes to create a typical multiple machine clustered WebLogic Server environment </li>
</ul>
I've started working on the first task, where I've also explored using <a href="https://www.docker.io/" target="_blank">Docker</a> to create an isolated, reusable and easily shareable environment that contains the <a href="https://downloads.chef.io/chef-dk/" target="_blank">ChefDK</a>. <br />
<br />
The Docker project is here on GitHub: <br />
<ul>
<li><a href="https://github.com/buttso/chef-docker">https://github.com/buttso/chef-docker</a> </li>
</ul>
I also tried a quick experiment with using Oracle Linux as the base docker image:<br />
<ul>
<li><a href="https://github.com/buttso/chef-docker-ol">https://github.com/buttso/chef-docker-ol</a></li>
</ul>
The <a href="https://github.com/buttso/chef-docker/blob/master/Dockerfile" target="_blank">Dockerfile</a> contains the set of instructions required to install the ChefDK and the necessary utilities into the docker image when it is built.<br />
<br />
<pre class="prettyprint lang-sh">#
# Dockerfile for Chef 4 WLS Environment
#
FROM ubuntu
MAINTAINER Steve Button <>
ENV DEBIAN_FRONTEND noninteractive
# Install Utilities
RUN apt-get update
RUN apt-get install -yq wget
RUN apt-get install -yq curl
RUN apt-get install -yq git
# Install Chef
RUN wget https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.3.5-1_amd64.deb
RUN dpkg -i chefdk*.deb
# Verify and Setup Chef
RUN chef verify
RUN echo 'eval "$(chef shell-init bash)"' << ~/.bashrc
...
CMD ["/bin/bash"]
</pre>
<br />
With this Dockerfile a build operation can be performed that produces a docker image, which can then be run to provide an environment in which start exploring the Chef.<br />
<br />
<pre class="prettyprint lang-sh">$ docker build -t buttso/chef4wls .
$ docker run -ti buttso/chef4wls
<b>oracle@5481a3330f27</b>:~$ which chef-client
/opt/chefdk/embedded/bin/chef-client
</pre>
<br/>
This is just a brief outline - I will describe this first task in more detail once I get a bit further along and can verify everything has been installed and works correctly.<br />
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-18012747464633800612014-09-12T13:08:00.004+09:302014-09-12T13:08:56.477+09:30Retro Day - Workload Management in WebLogic ServerQuite recently, I stumbled across this older but still very relevant whitepaper on the workload management capabilities of WebLogic Server. Written by one of the key engineers at the time, who later went on to become an architectect, it explains the workings of the new work load management feature introduced into WebLogic Server at the time and covers the concepts of work-manager configuration and effect, work scheduling and prioritization, overload protection and more.<br />
<br />
This is well worth a read if you are ever looking for good information on the work load management feature of WebLogic Server:<br />
<br />
<a href="http://www.oracle.com/technetwork/articles/entarch/workload-management4-101578.html">http://www.oracle.com/technetwork/articles/entarch/workload-management4-101578.html</a>Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-52308856228145212892014-07-31T16:17:00.000+09:302014-07-31T16:17:53.348+09:30Developing with JAX-RS 2.0 for WebLogic Server 12.1.3In an earlier post on the topic of<a href="http://buttso.blogspot.com.au/2014/03/using-jax-rs-20-in-weblogic-server-1213.html"> Using JAX-RS 2.0 with WebLogic Server 12.1.3</a>, I described that we've utilized the shared-library model to distribute and enable it.<br />
<br />
This approach exposes the JAX-RS 2.0 API and enlists the Jersey 2.x implementation on the target server, allowing applications to make use of it as when they are deployed through a library reference in a weblogic deployment descriptor.<br />
<br />
The one resulting consideration here from a development perspective is that since this API is not part of the javaee-api-6.jar nor is it a default API of the server, it's not available in the usual development API libraries that WebLogic provides.<br />
<br />
For instance the <code class="prettyprint"> $ORACLE_HOME/wlserver/server/lib/api.jar </code> doesn't contain a reference to the JAX-RS 2.0 API, nor do the set of maven artifacts we produce and push to a repository via the oracle-maven-sync plugin contain the <code class="prettyprint"> javax.ws.rs-api-2.0.jar </code> library.<br />
<br />
To develop an application using JAX-RS 2.0 to deploy to WebLogic Server 12.1.3, the javax.ws.rs-api-2.0.jar needs to be sourced and added to the development classpath.<br />
<br />
Using maven, this is very simple to do by adding an additional dependency for the <code class="prettyprint">javax.ws.rs:javax.ws.rs-api:2.0 </code> artifact that is hosted in public maven repositories:<br />
<br />
<pre class="prettyprint lang-xml"> <dependency>
<groupid>javax.ws.rs</groupid>
<artifactid>javax.ws.rs-api</artifactid>
<version>2.0</version>
<scope>provided</scope>
</dependency></pre>
<br />
Note here that the scope is set to <b>provided</b> since the library will be realized at runtime through <code class="prettyprint"> jax-rs-2.0.war </code> shared-library that it deployed to the target server and referenced by the application. It doesn't need to be packaged with the application to deploy to WebLogic Server 12.1.3.<br />
<br />
For other build systems using automated dependency management such as Gradle or Ant/Ivy, the same sort of approach can be used.<br />
<br />
For Ant based build systems, the usual approach of obtaining the necessary API libraries and adding them to the development CLASSPATH will work. Be mindful that there is no need to bundle the jax.ws.rs-ap-2.0.jar in the application itself as it will be available from the server when correctly deployed and referenced in the weblogic deployment descriptor.
Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com1tag:blogger.com,1999:blog-13556721.post-69356097198061007142014-07-30T16:41:00.003+09:302014-07-30T16:41:46.658+09:30Using Eclipse (OEPE) to Develop Applications using WebSocket and JSON Processing API with WebLogic Server 12.1.3Following from my <a href="http://buttso.blogspot.com/2014/07/developing-with-websocket-and-json.html" target="_blank">last posting</a>, I thought I'd also show how Eclipse (OEPE) makes the new Java EE 7 APIs available from Oracle WebLogic Server 12.1.3.<br />
<br />
The first step was downloading and installing the Oracle Enterprise Pack for Eclipse (OEPE) distribution from OTN.<br />
<br />
<a href="http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/index.html">http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/index.html</a> <br />
<br />
Firing up Eclipse, the next step is to add a new Server type for Oracle WebLogic Server 12.1.3, pointing at a local installation.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfwT9Zb0Gt4ChNG9bpSPzxP-LMbxLI4vqpNvg2URXtjtNZZeUpB92aw8AV1Jrh6FG0rK-xw6wq1JErOLx-i1txu0-n1htelIiqciBTxOoXT-CgziU-0pjlTMZpvVo5AwHetYqX/s1600/Screen+Shot+2014-07-30+at+4.31.26+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfwT9Zb0Gt4ChNG9bpSPzxP-LMbxLI4vqpNvg2URXtjtNZZeUpB92aw8AV1Jrh6FG0rK-xw6wq1JErOLx-i1txu0-n1htelIiqciBTxOoXT-CgziU-0pjlTMZpvVo5AwHetYqX/s1600/Screen+Shot+2014-07-30+at+4.31.26+pm.png" height="400" width="370" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXR_pWSoJnMhSLkDbodXhP6MPizNH_4kWqkC2EeXbgvKJlT2YjqSipalFk8e7JBwScelSIyNCHkxoTWZNW0Td3i2aFw-UbLrdHPrKpGnRqDh8wEuVn-dfi-McKNHbXeRnIpo-F/s1600/Screen+Shot+2014-07-30+at+4.31.02+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXR_pWSoJnMhSLkDbodXhP6MPizNH_4kWqkC2EeXbgvKJlT2YjqSipalFk8e7JBwScelSIyNCHkxoTWZNW0Td3i2aFw-UbLrdHPrKpGnRqDh8wEuVn-dfi-McKNHbXeRnIpo-F/s1600/Screen+Shot+2014-07-30+at+4.31.02+pm.png" height="343" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
With that done, I then created a new Dynamic Web Project that was directed to work against the new WebLogic Server type I'd created. Looking at the various properties for the project, you can see that the WebSocket 1.0 and JSON Programming 1.0 libraries are automatically picked up and added to the Java Build Path of the application, by virtue of being referenced as part of the WebLogic System Library.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXk4LpMka0XiCvlqHmFItqtru7YrDVLF5cS8V4wYIk6f5YFJbRZzQI46SxOiKQ2u4aRz9g7PPphyphenhyphenS6_LGk0DkS3yYPW7jTVBR0yIMSrHwOimJCIFKOdW3OwZb97Jtq4EjDWva/s1600/Screen+Shot+2014-07-30+at+2.12.48+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivXk4LpMka0XiCvlqHmFItqtru7YrDVLF5cS8V4wYIk6f5YFJbRZzQI46SxOiKQ2u4aRz9g7PPphyphenhyphenS6_LGk0DkS3yYPW7jTVBR0yIMSrHwOimJCIFKOdW3OwZb97Jtq4EjDWva/s1600/Screen+Shot+2014-07-30+at+2.12.48+pm.png" height="305" width="400" /></a></div>
<br />
<br />
Into this project, I then copied over the Java source and HTML page from my existing Maven project, which compiled and built successfully.<br />
<br />
For new applications using these APIs, Eclipse will detect the use of the javax.websocket API and annotations, the javax.json API calls and so forth and present you with a dialog asking you if you want to import the package to the class to resolve the project issues.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNfyZyYtmla5F74wmetQ9ytBHOQvWv3lT0RP2rMlRgJlWcypg52ITTO3OKYehZV-j2RSIm2xQUHx7bKtPckjE1jiI8dlPzZj6KT_Nv8RMNQk5qXCX8c70bTD-wktBTDp4Rn_dK/s1600/Screen+Shot+2014-07-30+at+2.14.00+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNfyZyYtmla5F74wmetQ9ytBHOQvWv3lT0RP2rMlRgJlWcypg52ITTO3OKYehZV-j2RSIm2xQUHx7bKtPckjE1jiI8dlPzZj6KT_Nv8RMNQk5qXCX8c70bTD-wktBTDp4Rn_dK/s1600/Screen+Shot+2014-07-30+at+2.14.00+pm.png" height="222" width="400" /></a></div>
<br />
<br />
With the application now ready, selecting the Run As > Run on Server menu option launches WebLogic Server, deploys the application and opens an embedded browser instance to access the welcome page of the application.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmBOv0qTxYMWIoCNDx9RajB8ppNtFCsq0QXZVqvC4hwBmQr5hT91Bw1kKTlBq5OLqfUV-V28Zx6dPXk98T7TY4iaYoQi30ZXXP28EU5u7SqYWccs9ByhnZoqZLBBGjfp3Rfvo5/s1600/Screen+Shot+2014-07-30+at+4.07.54+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmBOv0qTxYMWIoCNDx9RajB8ppNtFCsq0QXZVqvC4hwBmQr5hT91Bw1kKTlBq5OLqfUV-V28Zx6dPXk98T7TY4iaYoQi30ZXXP28EU5u7SqYWccs9ByhnZoqZLBBGjfp3Rfvo5/s1600/Screen+Shot+2014-07-30+at+4.07.54+pm.png" height="404" width="640" /></a></div>
<br />
And there's the test application built in Eclipse using the WebSocket and JSON Processing APIs running against WebLogic Server 12.1.3.<br />
<br />
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-37487151996658648422014-07-30T10:45:00.003+09:302014-07-30T10:51:16.646+09:30Developing with the WebSocket and JSON Processing API with WebLogic Server 12.1.3 and MavenOracle WebLogic Server 12.1.3 provides full support for Java EE 6 and also adds support for a select set of APIs from Java EE 7.<br />
<br />
The additional APIs are: <br />
<ul>
<li>JSR 356 - Java API for WebSocket 1.0</li>
<li>JSR 353 - Java API for JSON Processing</li>
<li>JSR 339 - Java API for RESTful Web Services 2.0</li>
<li>JSR 338 - Java Persistence API 2.1</li>
</ul>
See the "What's New in 12.1.3 Guide" at <a href="http://docs.oracle.com/middleware/1213/wls/NOTES/index.html#A1011612131">http://docs.oracle.com/middleware/1213/wls/NOTES/index.html#A1011612131</a> for more general information.<br />
<br />
At runtime, the WebSocket and JSON Processing APIs are available as defaults and don't require any form of post installation task to be performed to enable their use by deployed applications.<br />
<br />
On the other hand, the JPA and JAX-RS APIs require a step to enable them to be used by deployed applications.<br />
<br />
<h4>
Developing with the WebSocket and JSON Processing APIs using Maven</h4>
<h4>
</h4>
To create applications with these APIs for use with Oracle WebLogic Server 12.1.3, the API needs to be made available to the development environment. Typically when developing Java EE 6 applications, the javax:javaee-web-api artifact is used from the following dependency:<br />
<pre class="prettyprint lang-xml"><dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</pre>
<br />
As the WebSocket and JSON Processing APIs are not part of the Java EE 6 API, they need to be added to the project as dependencies.<br />
<br />
The obvious but <b>incorrect</b> way to do this is to change the javax:javaee-web-api dependency to be version 7 so that they are provided as part of that dependency. This introduces the Java EE 7 API to the application, including APIs such as Servlet 3.1, EJB 3.2 and so forth which aren't yet supported by WebLogic Server. Thus it presents the application developer with APIs to use that may not be available on the target server.<br />
<br />
The <b>correct</b> way to add the WebSocket and JSON Processing APIs to the project is to add individual dependencies for each API using their individual published artifacts.<br />
<br />
<pre class="prettyprint lang-xml"><dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency></pre>
<br />
Using NetBeans, these dependencies can be quickly and correctly added using the code-assist dialog, which presents developers with options for how to resolve any missing classes that have been used in the code.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnH-TFaO2MfpgV-z_4tmP3wocPcMRRmpovRLeAOtFrBqAmb_FELlkjHUjoMxhbjJPvpZhSAX1suhlIQjW52TQ3ukXoFstpqGLPQ7v9dQcNygb_mVrO1bqyVmpccMMLA4M5M1wm/s1600/Screen+Shot+2014-07-29+at+4.28.30+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnH-TFaO2MfpgV-z_4tmP3wocPcMRRmpovRLeAOtFrBqAmb_FELlkjHUjoMxhbjJPvpZhSAX1suhlIQjW52TQ3ukXoFstpqGLPQ7v9dQcNygb_mVrO1bqyVmpccMMLA4M5M1wm/s1600/Screen+Shot+2014-07-29+at+4.28.30+pm.png" height="640" width="548" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h4>
Using the JSON Processing API with WebSocket Applications</h4>
<h4>
</h4>
The JSON Processing API is particularly useful for WebSocket application development since it provides a simple and efficient API for parsing JSON messages into Java objects and for generating JSON from Java objects. These tasks are very typically performed in WebSocket applications using the Encoder and Decoder interfaces, which provides a mechanism for transforming custom Java objects into WebSocket messages for sending and converting WebSocket messages into Java objects.<br />
<br />
An Encoder converts a Java object into a form able to send as a WebSocket message, typically using JSON as the format for use within Web browser based JavaScript clients.
<br />
<pre class="prettyprint lang-java">package buttso.demo.cursor.websocket;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.json.Json;
import javax.json.JsonObject;
import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;
/**
* Convert a MouseMessage into a JSON payload.
*
* @author sbutton
*/
public class MouseMessageEncoder implements Encoder.Text<mousemessage>{
private static final Logger logger = Logger.getLogger(MouseMessageEncoder.class.getName());
@Override
public String encode(MouseMessage mouseMessage) throws EncodeException {
logger.log(Level.FINE, mouseMessage.toString());
JsonObject jsonMouseMessage = Json.createObjectBuilder()
.add("X", mouseMessage.getX())
.add("Y", mouseMessage.getY())
.add("Id", mouseMessage.getId())
.build();
logger.log(Level.FINE, jsonMouseMessage.toString());
return jsonMouseMessage.toString();
}
@Override
public void init(EndpointConfig ec) {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void destroy() {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}</mousemessage></pre>
<br />
An Decoder takes a String from a WebSocket message and turns it into a custom Java object, typically receiving a JSON payload that has been constructed and sent from a Web browser based JavaScript client.
<br />
<pre class="prettyprint lang-java">package buttso.demo.cursor.websocket;
import java.io.StringReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.json.Json;
import javax.json.JsonObject;
import javax.websocket.Decoder;
import javax.websocket.EndpointConfig;
/**
* Converts a JSON payload into a MouseMessage
*
* @author sbutton
*/
public class MouseMessageDecoder implements Decoder.Text<mousemessage> {
private static final Logger logger = Logger.getLogger(MouseMessageDecoder.class.getName());
@Override
public MouseMessage decode(String message) {
logger.log(Level.FINE, message);
JsonObject jsonMouseMessage = Json.createReader(new StringReader(message)).readObject();
MouseMessage mouseMessage = new MouseMessage();
mouseMessage.setX(jsonMouseMessage.getInt("X"));
mouseMessage.setY(jsonMouseMessage.getInt("Y"));
logger.log(Level.FINE, mouseMessage.toString());
return mouseMessage;
}
@Override
public boolean willDecode(String string) {
return true;
}
@Override
public void init(EndpointConfig ec) {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void destroy() {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}</mousemessage></pre>
<br />
The Encoder and Decoder implementations are specified as configuration elements on a WebSocket Endpoint (server and/or client) and are automatically invoked to perform the required conversion task.
<br />
<pre class="prettyprint lang-java">@ServerEndpoint(value = "/mouse", decoders = MouseMessageDecoder.class, encoders = MouseMessageEncoder.class)
public class MouseWebSocket {
private final Logger logger = Logger.getLogger(MouseWebSocket.class.getName());
...
@OnMessage
public void onMessage(Session peer, MouseMessage mouseMessage) throws EncodeException {
logger.log(Level.FINE, "MouseMessage {0} from {1}", new Object[]{mouseMessage, peer.getId()});
messages.add(mouseMessage);
for (Session others : peer.getOpenSessions()) {
try {
if (!others.getId().equals(peer.getId())) {
mouseMessage.setId((int) peer.getUserProperties().get("id"));
}
others.getBasicRemote().sendObject(mouseMessage);
} catch (IOException ex) {
Logger.getLogger(MouseWebSocket.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
...
}</pre>
This example enables MouseMessage objects to be used in the WebSocket ServerEndpoint class to implement the required functionality and allow them to be transmitted in JSON format to and from clients. On the JavaScript client, the JSON representation is used to receive MouseMessages sent from the WebSocket Endpoint and to send MouseMessages to the same WebSocket Endpoint.<br />
<br />
The JavaScript JSON API can be used to produce JSON representation of JavaScript objects as well as parse JSON payloads into JavaScript objects for use by the application code. For example, JavaScript logic can be used to send messages to WebSocket endpoints in JSON form using the JSON.stringify function and to create JavaScript objects from JSON messages received from a WebSocket message using the JSON.parse function.<br />
<br />
<pre class="prettyprint lang-javascript"> ...
document.onmousemove = function(e) {
if (tracking) {
// send current mouse position to websocket in JSON format
ws.send(JSON.stringify({X: e.pageX, Y: e.pageY}));
}
}
ws.onmessage = function(e) {
// convert JSON payload into JavaScript object
mouseMessage = JSON.parse(e.data);
// create page element using details from received
// MouseMessage from the WebSocket
point = document.createElement("div");
point.style.position = "absolute";
point.style.zIndex = mouseMessage.Id;
point.style.left = mouseMessage.X + "px";
point.style.top = mouseMessage.Y + "px";
point.style.color = colors[mouseMessage.Id];
point.innerHTML = "∗";
document.getElementById("mouser").appendChild(point);
};</pre>
When running the application, the mouse events are captured from the Web client, send to the WebSocket endpoint in JSON form, converted into MouseMessages, decorated with an ID representing the client the message came from and then broadcast out to any other connect WebSocket client to display.<br />
<br />
A very crude shared-drawing board. <br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvLsa-7_EPXrOLpp0CLWkFrVKBMUPz137BeLAQjWdp-8G7cDGiqQlka2qCoSEfUAFsnGVuhxfUgBeVbjIGHVogtx5EOPqH9IQz7yS5a7oq-7IIiqUyIHBnO6kpyH0905ZgOFP4/s1600/Screen+Shot+2014-07-30+at+10.34.20+am.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvLsa-7_EPXrOLpp0CLWkFrVKBMUPz137BeLAQjWdp-8G7cDGiqQlka2qCoSEfUAFsnGVuhxfUgBeVbjIGHVogtx5EOPqH9IQz7yS5a7oq-7IIiqUyIHBnO6kpyH0905ZgOFP4/s1600/Screen+Shot+2014-07-30+at+10.34.20+am.png" height="267" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Simulatenous drawing in browser windows using WebSocket and JSON Processing API</td></tr>
</tbody></table>
Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com1tag:blogger.com,1999:blog-13556721.post-2849430647895858562014-04-22T14:42:00.003+09:302014-04-22T16:37:56.991+09:30Cycle4Sam 5 - Riding 1000km in 6 days for $100k for Women's and Children's Hospital<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.cycle4sam.com/images/logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.cycle4sam.com/images/logo.png" /></a></div>
<br />
<br />
I recently participated in a week long charity bike ride called <b>Cycle4Sam,</b> where funds are raised to support the palliative care unit at the Women and Children's Hospital of South Australia.<br />
<br />
The ride is conducted on a bi-annual basis in honour of young Sam Roberts, who sadly passed away from a rare genetic disease at the age of 4. His parents, Marty and Michelle and his siblings Lucy and Charlie, created the Sam Roberts Family Fund in order to raise funds and provide help for other families who find themselves in the same situation.<br />
<br />
<h4 style="text-align: center;">
<b><a href="http://www.cycle4sam.com/">http://www.cycle4sam.com/</a></b></h4>
<br />
As the major fundraising effort, the Cycle4Sam ride sees a group of riders raise funds through sponsors to participate in a ride of 1000km.
This years ride started on April 12th from the regional South Australia city of Renmark and finished back in Adelaide on April 18th, covering 1000km over 6 days of riding.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZXvSIX_ShbYU3refZRT-SZ4gku9-fn2exmiiddJrc0S1YUt5L4fwnT2XGpC-yzJIWno9TnfvbRqbSutiF_5PLvYWCBLF5evBtEOB3iPBT8f1KPDlUwMUBFixoLwjP1GhdZzJr/s1600/Screen+Shot+2014-04-22+at+2.35.20+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZXvSIX_ShbYU3refZRT-SZ4gku9-fn2exmiiddJrc0S1YUt5L4fwnT2XGpC-yzJIWno9TnfvbRqbSutiF_5PLvYWCBLF5evBtEOB3iPBT8f1KPDlUwMUBFixoLwjP1GhdZzJr/s1600/Screen+Shot+2014-04-22+at+2.35.20+pm.png" height="231" width="320" /></a></div>
<br />
<br />
Day 1 was run as a loop of the Riverland region, taking in Loxton, Berry and a number of other lovely little towns on the way back to Renmark. A small ceremony was held at the start to honour and remember Sam and other little children who are suffering in the same way.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqxIYqQDn6R7JoG-1eF4nHOVTWCKCK46jQe_5e2wn68RulS1iITBU9Kn-P9Ws9nsDMR_ZOd951TKWsmIhTxmaWI-DFpN-JIeK4EvkivPRAn4V9RrTjY8obW2uLQxM7oA6KpFa1/s1600/Screen+Shot+2014-04-22+at+2.32.01+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqxIYqQDn6R7JoG-1eF4nHOVTWCKCK46jQe_5e2wn68RulS1iITBU9Kn-P9Ws9nsDMR_ZOd951TKWsmIhTxmaWI-DFpN-JIeK4EvkivPRAn4V9RrTjY8obW2uLQxM7oA6KpFa1/s1600/Screen+Shot+2014-04-22+at+2.32.01+pm.png" height="320" width="240" /></a></div>
<br />
<br />
Day 2 was a transit stage, riding from Renmark to a small town along the River Murray called Walker Flat.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCfSxuh-NPOJb6wG6rY2fMqDIacHFBvNcmt7hnz3RYHGimsBs8Zydf4x581J1P-kw0BRdzAf0sisyfmgYNHSsLeivYZZaLU9jvE87J64Oy-5S2rhdd6hu78Swk8qGEcaQXpFZ0/s1600/Screen+Shot+2014-04-22+at+2.31.27+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCfSxuh-NPOJb6wG6rY2fMqDIacHFBvNcmt7hnz3RYHGimsBs8Zydf4x581J1P-kw0BRdzAf0sisyfmgYNHSsLeivYZZaLU9jvE87J64Oy-5S2rhdd6hu78Swk8qGEcaQXpFZ0/s1600/Screen+Shot+2014-04-22+at+2.31.27+pm.png" height="247" width="320" /></a></div>
<br />
<br />
Day 3 took in a loop of the iconic Barossa Valley region through the towns of Sedan, Angaston, Tanunda, Mt Prospect and back to Walker Flat. This day had some nice climbing with the Sedan Hill and Menglers Hill included as the main climbs of the day on the back of the generally rolling terrain of the region.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPrNcgrK5WWnqC9YstqOtmBPMO4u6qnLxJq6UYTRE9V5vZbMeroQfJFiddhMak6IFIeTZ-BbxERLyYFIG6w3JrXPABWLEJ5RGHbZZrwziRiT8PcpP7RhlN2_CfgewHoFaxpvXX/s1600/Screen+Shot+2014-04-22+at+2.31.45+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPrNcgrK5WWnqC9YstqOtmBPMO4u6qnLxJq6UYTRE9V5vZbMeroQfJFiddhMak6IFIeTZ-BbxERLyYFIG6w3JrXPABWLEJ5RGHbZZrwziRiT8PcpP7RhlN2_CfgewHoFaxpvXX/s1600/Screen+Shot+2014-04-22+at+2.31.45+pm.png" height="248" width="320" /></a></div>
<br />
<br />
<br />
Day 4 was another long day, riding from Walker Flat to the southern beach town of Carrackalinga. A planned stop at the Woodstock winery to meet up with another family who were afflicted in the same way as the Roberts saw the day come to a slightly unscheduled but much welcomed end, with a short'ish bus transit down to the final stay over.<br />
<br />
<br />
Day 5 was a rest-day, or more accurately a non-riding day for those of us with kids, which had us taking the kids for a lovely bike ride along the beach front from Normanville to Carrackalinga, followed by a King of the Mountain event up the Latvian Climb. Tough work for little legs but they all did superbly.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1MZMArMspu-HBZf4qY0kvGJWzFV41B8wXEa5QeDj9UIsE6bIWsSlv0zEAewUtVBmd5oIREP4PTWsy5bF9oJHgpETRQRRFwZKkTKCLxKEZpwyV13coZWI-2KRTboqr47vvus65/s1600/Screen+Shot+2014-04-22+at+2.31.10+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1MZMArMspu-HBZf4qY0kvGJWzFV41B8wXEa5QeDj9UIsE6bIWsSlv0zEAewUtVBmd5oIREP4PTWsy5bF9oJHgpETRQRRFwZKkTKCLxKEZpwyV13coZWI-2KRTboqr47vvus65/s1600/Screen+Shot+2014-04-22+at+2.31.10+pm.png" height="230" width="320" /></a></div>
<br />
<br />
Day 6 was a loop around the Fleurieu Peninsula taking in the lovely back road around Parawa down to Victor Harbor, down to Goolwa and back to Port Elliot for lunch. A summit of the Crows Nest followed, by a ride up the Myponga Reservoir climb, closing by a screaming descent down to Carrackaling and back to Normanville.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE-oUf1skre1qhzCO8EdBL86wXsVLE5MedML_eHa5XB5VjUzEjyWq3i3ZvUV8WiFzifFbd7Xtf7_tX19J7spu3fT7UXSw6iuPkyqaurXpeK4qx8y2NvW4B1Haj1tJ_h_Xds-c5/s1600/Screen+Shot+2014-04-22+at+2.37.45+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE-oUf1skre1qhzCO8EdBL86wXsVLE5MedML_eHa5XB5VjUzEjyWq3i3ZvUV8WiFzifFbd7Xtf7_tX19J7spu3fT7UXSw6iuPkyqaurXpeK4qx8y2NvW4B1Haj1tJ_h_Xds-c5/s1600/Screen+Shot+2014-04-22+at+2.37.45+pm.png" height="235" width="320" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIdBcbsUHOsn-HdiXiEH66_2u9qc7GFCxv7SkrNLiGbfEDML9187JiSV9dZihhREbSpiAUb173G6TH2uX-S7buabNWARLQ33-h5FuGpX2_BJc9nGuLp4d2uxvzBLNw-8BDWaQg/s1600/Screen+Shot+2014-04-22+at+2.39.00+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIdBcbsUHOsn-HdiXiEH66_2u9qc7GFCxv7SkrNLiGbfEDML9187JiSV9dZihhREbSpiAUb173G6TH2uX-S7buabNWARLQ33-h5FuGpX2_BJc9nGuLp4d2uxvzBLNw-8BDWaQg/s1600/Screen+Shot+2014-04-22+at+2.39.00+pm.png" height="219" width="320" /></a></div>
<br />
<br />
Day 7 was the final day and took us back to Adelaide through the McLaren Vale, Mylor, Aldgate Valley, Stirling and down the freeway, where we were escorted by the SA Police through to the grounds of the Women's and Children's Hospital.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhogBcODoz5v1og2g4QQVN0_Sve3Jwv3Ab6BQi61h-2NHeNw7cdF8t7TXFqKV9Bdrzun15SyNF1VqCc1Y7NTV6aJkzZNQwKYMwR8XCPrYa2d0XN7LuCMCewgzcd-x-tuSt54pQ1/s1600/Screen+Shot+2014-04-22+at+2.30.33+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhogBcODoz5v1og2g4QQVN0_Sve3Jwv3Ab6BQi61h-2NHeNw7cdF8t7TXFqKV9Bdrzun15SyNF1VqCc1Y7NTV6aJkzZNQwKYMwR8XCPrYa2d0XN7LuCMCewgzcd-x-tuSt54pQ1/s1600/Screen+Shot+2014-04-22+at+2.30.33+pm.png" height="235" width="320" /></a></div>
<br />
<br />
As part of the closing celebrations, the Roberts Family presented the Women's and Children's Hospital with a cheque for $100,000 that was raised by the event.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMv63hnPVgGsF3o6mJu1Kdu5guJ60EBa6NA1LXWQDIa3Lzq-MhvilUKvG1uWW__cMkLG0KT5eAiWETAv-W9zcXCNJzwxptTvJ4isdPLKdoK8FLvc0Di-O_wdcmZHcJUsjb2xMV/s1600/Screen+Shot+2014-04-22+at+WCH+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMv63hnPVgGsF3o6mJu1Kdu5guJ60EBa6NA1LXWQDIa3Lzq-MhvilUKvG1uWW__cMkLG0KT5eAiWETAv-W9zcXCNJzwxptTvJ4isdPLKdoK8FLvc0Di-O_wdcmZHcJUsjb2xMV/s1600/Screen+Shot+2014-04-22+at+WCH+pm.png" height="320" width="320" /></a></div>
<br />
<br />
<h4 style="text-align: center;">
<a href="http://wchfgivinghearts.org.au/event/cycle4sam">http://wchfgivinghearts.org.au/event/cycle4sam</a> </h4>
<br />
I was in the company of an outstanding group of people performing an outstanding service for the community and I thank them all for the privilege of letting me share the event with them.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghPPu9iiFZuQJG9IIotnsnT3040ZT6oVo8DBR_QfdZJZNC3P03cuKmN8gEFd0Y129ley9LsBV1Uk6uOUByCd1Y-fxpnoAxu9Zlvg_v5PufyR5Rvh-UYH6QBkvUvvJKq-3oQGYe/s1600/Screen+Shot+2014-04-22+at+2.39.33+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghPPu9iiFZuQJG9IIotnsnT3040ZT6oVo8DBR_QfdZJZNC3P03cuKmN8gEFd0Y129ley9LsBV1Uk6uOUByCd1Y-fxpnoAxu9Zlvg_v5PufyR5Rvh-UYH6QBkvUvvJKq-3oQGYe/s1600/Screen+Shot+2014-04-22+at+2.39.33+pm.png" height="199" width="320" /></a></div>
<br />
<br />
<br />
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com1tag:blogger.com,1999:blog-13556721.post-7776794378503074152014-04-03T10:15:00.001+10:302014-04-03T10:18:03.510+10:30MaxPermSize Be Gone!<pre style="color:white; background-color: black; width: 85%; padding: 10px;">
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
</pre>
No further commentary required.Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com0tag:blogger.com,1999:blog-13556721.post-31788203100057182072014-03-25T08:07:00.000+10:302014-08-01T10:16:02.596+09:30JSON Parsing is Cake with WebLogic Server 12.1.3Another feature of WebLogic Server 12.1.3 that developers will find really useful is the inclusion of an implementation of JSR-353 Java API for JSON Processing.<br />
<br />
See Chapter 10 Java API for JSON Processing in the Developing Applications for Oracle WebLogic Server book @ <a href="http://docs.oracle.com/middleware/1213/wls/WLPRG/java-api-for-json-proc.htm#WLPRG1055" target="_blank">http://docs.oracle.com/middleware/1213/wls/WLPRG/java-api-for-json-proc.htm#WLPRG1055 </a><br />
<br />
The original JSR submission for this API provides a good description of what it sets out to do.<br />
<br />
<a href="https://jcp.org/en/jsr/detail?id=353">JSR 353: JavaTM API for JSON Processing</a><br />
<br />
This new API, working from the foundations provided by earlier implementations such as Jackson, Jettison and Google JSon, provides a standard API for working with JSON from Java. The goals and objectives of the API are described in the specification request as:<br />
<blockquote class="tr_bq">
JSON(JavaScript Object Notation) is a lightweight data-interchange
format.<br />
<br />
Many popular web services use JSON format for invoking and
returning the data.<br />
<br />
Currently Java applications use different
implementation libraries to produce/consume JSON from the web services.
Hence, there is a need to standardize a Java API for JSON so that
applications that use JSON need not bundle the implementation libraries
but use the API. Applications will be smaller in size and portable.<br />
<br />
The goal of this specification is to develop such APIs to:<br />
<ul>
<li>Produce and consume JSON text in a streaming fashion(similar to StAX API for XML)</li>
<li>Build a Java object model for JSON text using API classes(similar to DOM API for XML)
</li>
</ul>
</blockquote>
WebLogic Server 12.1.3 includes a module which contains the API/implementation of this relatively lightweight but important API, enabling developers and applications to more easily work with JSON in a portable, standard manner.<br />
<br />
Unlike JAX-RS 2.0 and JPA 2, both of which have pre-existing specification versions that need to be supported by default, there are no additional steps required for applications to use this API with WebLogic Server 12.1.3. It's simply included as a default module of the server and available for any application to make use of.<br />
The API and implementation is located in this jar file in a WebLogic Server 12.1.3 installation:<br />
<br />
<pre class="prettyprint lang-sh">$ORACLE_HOME/wlserver/modules/javax.json_1.0.0.0_1-0.jar</pre>
<br />
In the my previous post, <a href="http://buttso.blogspot.com.au/2014/03/using-jax-rs-20-client-api-with.html">Using the JAX-RS 2.0 Client API with WebLogic Server 12.1.3</a><br />
I have a short example of using the API to parse an JAX-RS supplied InputStream to marshall a JSON payload into a Java object. <br />
<br />
<pre class="prettyprint lang-java">
...
GeoIp g = new GeoIp();
JsonParser parser = Json.createParser(entityStream);
while (parser.hasNext()) {
switch (parser.next()) {
case KEY_NAME:
String key = parser.getString();
parser.next();
switch (key) {
case "ip":
g.setIpAddress(parser.getString());
break;
case "country_name":
g.setCountryName(parser.getString());
break;
case "latitude":
g.setLatitude(parser.getString());
break;
case "longitude":
g.setLongitude(parser.getString());
break;
case "region_name":
g.setRegionName(parser.getString());
break;
case "city":
g.setCity(parser.getString());
break;
case "zipcode":
g.setZipCode(parser.getString());
break;
default:
break;
}
break;
default:
break;
}
}
...</pre>
<pre class="prettyprint lang-java"> </pre>
The Java EE 7 tutorial has a section showing how to use the new javax.json API which is well worth having a look at if working with JSON is your thing.<br />
<br />
<a href="http://docs.oracle.com/javaee/7/tutorial/doc/jsonp.htm">http://docs.oracle.com/javaee/7/tutorial/doc/jsonp.htm</a><br />
<br />
Arun Gupta also has a good hands-on lab under development for Java EE 7 that uses the JSON API to read and write JSON into Java objects that represent a movie database. His examples collaborate with JAX-RS to issue both GET and POST calls to read and update data using JSON payload.<br />
<br />
<a href="https://github.com/javaee-samples/javaee7-samples">https://github.com/javaee-samples/javaee7-samples</a><br />
<br />
<br />
<br />Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com1tag:blogger.com,1999:blog-13556721.post-10017173323536045172014-03-24T15:21:00.001+10:302014-03-27T14:35:23.058+10:30Using the JAX-RS 2.0 Client API with WebLogic Server 12.1.3
<div style="text-align: center; clear:both; color: #FF1111; border: 2px solid #FF1111; padding: 15px;">
<br/>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiXXTZshyphenhyphen_i_Yis5MwPsp3dixRAn1OEh7Bz9_hwuxgaxsW3dNt6obHBYrw5xRWChakMjhnozFZDnnzuThxzzMXmY0LJ3aeELzH15ZmJoniURKDZEzaRb7tbKwnDd-EG_gszcWw/s1600/safe-harbour.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiXXTZshyphenhyphen_i_Yis5MwPsp3dixRAn1OEh7Bz9_hwuxgaxsW3dNt6obHBYrw5xRWChakMjhnozFZDnnzuThxzzMXmY0LJ3aeELzH15ZmJoniURKDZEzaRb7tbKwnDd-EG_gszcWw/s400/safe-harbour.png" /></a></div>
<br/>
Please note: this blog discusses WebLogic Server <strong>12.1.3</strong><br/> which has not yet been released.
<br/>
</div>
</br>
As part of the JAX-RS 2.0 support we are providing with WebLogic Server 12.1.3, one really useful new feature is the new Client API it provides, enabling applications to easily interact with REST services to consume and publish information.<br />
<br />
By way of a simple example, I'll build out an application that uses the <a http="freegeoip.net">freegeoip.net</a> REST service to lookup the physical location of a specified IP address or domain name and deploy it to WebLogic Server 12.1.3.<br />
<br />
The first step to perform is to make a call to the <b>freegeoip.net</b> REST API and examine the JSON payload that is returned.<br />
<pre class="prettyprint">
$ curl http://freegeoip.net/json/buttso.blogspot.com
{"ip":"173.194.115.75","country_code":"US","country_name":"United States","region_code":"CA","region_name":"California","city":"Mountain View","zipcode":"94043","latitude":37.4192,"longitude":-122.0574,"metro_code":"807","area_code":"650"}
</pre>
The next step is to build a Java class to represent the JSON payload that is returned. In this case, it's quite simple because the JSON payload that is returned doesn't contain any relationships or complex data structures.
<pre class="prettyprint">
/**
*
* @author sbutton
* {"ip":"173.194.115.75","country_code":"US","country_name":"United States","region_code":"CA","region_name":"California","city":"Mountain View","zipcode":"94043","latitude":37.4192,"longitude":-122.0574,"metro_code":"807","area_code":"650"}
*/
public class GeoIp implements Serializable {
private String ipAddress;
private String countryName;
private String regionName;
private String city;
private String zipCode;
private String latitude;
private String longitude;
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
...
}</pre>
With the <code class="prettyprint"> GeoIP </code> class defined, the next step is to consider how to convert the JSON payload into an instance of the <code class="prettyprint"> GeoIP </code> class. I'll show two ways this can be done.
<br/>
<br/>
The first way to do it is to create a class that reads the result of the REST request, parses the JSON payload and constructs a representative instance of the <code class="prettyprint"> GeoIP </code> class. Within the JAX-RS API, there is an interface <code class="prettyprint"> MessageBodyReader </code> that can be implemented to convert a Stream into a Java type.
<br/>
<br/>
<a href="http://docs.oracle.com/javaee/7/api/javax/ws/rs/ext/MessageBodyReader.html">http://docs.oracle.com/javaee/6/api/javax/ws/rs/ext/MessageBodyReader.html</a>
<br/>
<br/>
Implementing this interface gives you the <code class="prettyprint lang-java"> readFrom(Class<GeoIp> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) </code> method which supplies an InputStream containing the response to read. The method then parses out the JSON payload and constructs a responding <code class="prettyprint"> GeoIP </code> instance from it.<br/>
<br/>
Parsing the JSON payload is straightforward with WebLogic Server 12.1.3 since we've included the (JSR-353) Java API for JSON Processing implementation which provides an API for reading and creating JSON objects.
<br/>
<pre class="prettyprint lang-java">
package oracle.demo.wls.jaxrs.client.geoip;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.json.Json;
import javax.json.stream.JsonParser;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.Provider;
@Provider
@Produces(MediaType.APPLICATION_JSON)
public class GeoIpReader implements MessageBodyReader<GeoIp> {
@Override
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return GeoIp.class.isAssignableFrom(type) ;
}
@Override
public GeoIp readFrom(Class<GeoIp> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
GeoIp g = new GeoIp();
JsonParser parser = Json.createParser(entityStream);
while (parser.hasNext()) {
switch (parser.next()) {
case KEY_NAME:
String key = parser.getString();
parser.next();
switch (key) {
case "ip":
g.setIpAddress(parser.getString());
break;
case "country_name":
g.setCountryName(parser.getString());
break;
case "latitude":
g.setLatitude(parser.getString());
break;
case "longitude":
g.setLongitude(parser.getString());
break;
case "region_name":
g.setRegionName(parser.getString());
break;
case "city":
g.setCity(parser.getString());
break;
case "zipcode":
g.setZipCode(parser.getString());
break;
default:
break;
}
break;
default:
break;
}
}
return g;
}
}
</pre>
<br/>
Once this class is built, it can be registered with the <code class="prettyprint"> Client </code> so that it can be called when necessary to convert a payload of <code class="prettyprint">MessageType.APPLICATION_JSON</code> type into an instance of the <code class="prettyprint"> GeoIP </code> object, here done in an <code class="prettyprint"> @PostConstruct </code> method on a JSF Bean
<br/>
<pre class="prettyprint lang-java">
@PostConstruct
public void init() {
client = ClientBuilder.newClient();
client.register(GeoIpReader.class);
}
</pre>
<br/>
<br/>The alternative way to do thi is to use the EcliseLink MOXY JAXB implementation that is provided with WebLogic Server, which can automatically marhsall and unmarshall JSON payloads to and from Java objects. Helpfully, the JAX-RS 2.0 shared-library that WebLogic Server 12.1.3 contains the jersey-media-moxy extension that enables the EclipseLInk MOXY implementation to be simply registered and used by applications when conversion is needed.</br>
<br/>
To use the JAXB/MOXY approach, the <code class="prettyprint"> GeoIPReader </code> class can be thrown away. No manual parsing of the payload is required. Instead, the base <code class="prettyprint"> GeoIP </code> class is annotated with JAXB annotations to denote it as being JAXB enabled and to provide some assistance in the mapping of the class properties to the payload property names.<br/>
<pre class="prettyprint lang-java">
package oracle.demo.wls.jaxrs.client.geoip;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author sbutton
* {"ip":"173.194.115.75","country_code":"US","country_name":"United States","region_code":"CA","region_name":"California","city":"Mountain View","zipcode":"94043","latitude":37.4192,"longitude":-122.0574,"metro_code":"807","area_code":"650"}
*/
@XmlRootElement
public class GeoIp implements Serializable {
@XmlAttribute(name = "ip")
private String ipAddress;
@XmlAttribute(name = "country_name")
private String countryName;
@XmlAttribute(name = "region_name")
private String regionName;
@XmlAttribute(name = "city")
private String city;
@XmlAttribute(name = "zipcode")
private String zipCode;
@XmlAttribute(name = "latitude")
private String latitude;
@XmlAttribute(name = "longitude")
private String longitude;
...
}
</pre>
<br/>
With the JAXB annotations placed on the <code class="prettyprint"> GeoIP </code> class to enable it to be automatically marshalled/unmarshalled from JSON, the last step is to register the EclipseLink MOXY implementation with the Client. This is done with the assistance of a small utility method, as shown in the Jersey User Guide <a href="https://jersey.java.net/nonav/documentation/2.6/media.html#json.moxy">Media</a> chapter.<br/>
<pre class="prettyprint lang-java">
public static ContextResolver<MoxyJsonConfig> createMoxyJsonResolver() {
final MoxyJsonConfig moxyJsonConfig = new MoxyJsonConfig();
moxyJsonConfig.setFormattedOutput(true);
Map<String, String> namespacePrefixMapper = new HashMap<String, String>(1);
namespacePrefixMapper.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
moxyJsonConfig.setNamespacePrefixMapper(namespacePrefixMapper).setNamespaceSeparator(':');
return moxyJsonConfig.resolver();
}
</pre>
This method is then used to register the relevant <code class="prettyprint"> ContextResolver </code> with the <code class="prettyprint"> Client </code> to use to handle JSON_conversions, instead of the <code class="prettyprint"> GeoIPReader </code> class that was used before.< <br/>
<pre class="prettyprint lang-java">
@PostConstruct
public void init() {
client = ClientBuilder.newClient();
client.register(createMoxyJsonResolver());
//client.register(GeoIpReader.class);
}
</pre>
<br/>
With the JSON payload to <code class="prettyprint"> GeoIP </code> conversion now covered, the JAX-RS Client API can be used to make the call to the freegeoip REST service and process the response.<br/>
<br/>
To make a client call, two classes are used: <code class="prettyprint"> javax.ws.rs.client.Client </code> and <code class="prettyprint"> javax.ws.rs.client.WebTarget </code>.</br>
</br>
The Jersey User Guide provides a good description of theses two classes and their relationship:</br>
<br/>
<div style="padding-left: 15px; padding-right: 15px; font-style: italic;">
The JAX-RS Client API is a designed to allow fluent programming model. This means, a construction of a Client instance, from which a WebTarget is created, from which a request Invocation is built and invoked can be chained in a single "flow" of invocations ... Once you have a Client instance you can create a WebTarget from it ... A resource in the JAX-RS client API is an instance of the Java class WebTarget and encapsulates an URI. The fixed set of HTTP methods can be invoked based on the WebTarget. The [base] representations are Java types, instances of which, may contain links that new instances of WebTarget may be created from.
</div>
<br/>
In this example application, the Client is opened in an <code class="prettyprint"> @PostConstruct </code> method and closed in a <code class="prettyprint"> @PreDestroy </code> method, with the <code class="prettyprint"> WebTarget </code> being created and its <code class="prettyprint"> GET </code> method called when the lookup is executed by the user.<br/>
<pre class="prettyprint lang-java">
@Named
@RequestScoped
public class GeoIpBackingBean {
private WebTarget target = null;
private Client client = null;
...
@PostConstruct
public void init() {
client = ClientBuilder.newClient();
//client.register(createMoxyJsonResolver());
client.register(GeoIpReader.class);
}
@PreDestroy
public void byebye() {
client.close();
}
public void lookupAddress() {
try {
target = client.target(String.format(rest_base_url, addressToLookup));
geoIp = target.request().get(GeoIp.class);
} catch (Exception e) {
e.printStackTrace();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Error executing REST call: " + e.getMessage()));
}
}
...
}
</pre>
</br>
</br>
Bringing it all together as a JSF based application results in a JSF Bean being created that allows the IP address to be entered and a method that invokes the JAX-RS Client API to call out to the freegeoip.net REST service to retrieve the JSON payload containing the location information. A simple JSF facelet page is used to support the entering of the IP address and the display of the relevant data from the <code class="prettyprint"> GeoIP </code> object.<br/>
<br/>
<pre class="prettyprint lang-xml">
<h:form>
<h:panelGrid columns="2" style="vertical-align: top;">
<h:outputLabel value="Address"/>
<h:inputText value="${geoIpBackingBean.addressToLookup}"/>
<h:outputLabel value=""/>
<h:commandButton action="${geoIpBackingBean.lookupAddress()}" value="Lookup" style="margin: 5px;"/>
</h:panelGrid>
</h:form>
<h:panelGrid columns="2">
<h:outputText value="IP:"/>
<h:outputText value="${geoIpBackingBean.geoIp.ipAddress}"/>
<h:outputText value="Country Code:"/>
<h:outputText value="${geoIpBackingBean.geoIp.countryName}"/>
<h:outputText value="State:"/>
<h:outputText value="${geoIpBackingBean.geoIp.regionName}"/>
<h:outputText value="City"/>
<h:outputText value="${geoIpBackingBean.geoIp.city}"/>
<h:outputText value="Zipcode:"/>
<h:outputText value="${geoIpBackingBean.geoIp.zipCode}"/>
<h:outputText value="Coords:"/>
<c:if test="${geoIpBackingBean.geoIp.ipAddress != null}">
<h:outputText value="${geoIpBackingBean.geoIp.latitude},${geoIpBackingBean.geoIp.longitude}"/>
</c:if>
</h:panelGrid>
</pre>
<br/>
The last step to perform is to add a weblogic.xml deployment descriptor with a library-ref to the [jsf,2.0] shared-library, which must be deployed as I described earlier in <a href="http://buttso.blogspot.com.au/2014/03/using-jax-rs-20-in-weblogic-server-1213.html">Using JAX-RS 2.0 with WebLogic Server 12.1.3</a>.<br/>
<br/>The application is now ready to to deploy and run.
<br/>
<br/>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEignxDRy_MRkVQAXNymrTBJi0EB9P2BaQuClXmn29guWAATvG4NAzK8KYXRhyV9vQEd1kEgxjV36dq23SYK6FI7AIgQ3-gEG76XVZfV5lPvhI9LPaoTuiqqJ-WmWAVLnUxsjB6o/s1600/Screen+Shot+2014-03-24+at+3.12.25+pm.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="1" style="border=1px solid #0088AA;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEignxDRy_MRkVQAXNymrTBJi0EB9P2BaQuClXmn29guWAATvG4NAzK8KYXRhyV9vQEd1kEgxjV36dq23SYK6FI7AIgQ3-gEG76XVZfV5lPvhI9LPaoTuiqqJ-WmWAVLnUxsjB6o/s1600/Screen+Shot+2014-03-24+at+3.12.25+pm.png" /></a></div>
Buttsohttp://www.blogger.com/profile/03968454565733104381noreply@blogger.com2