If you learned something
today, please
1x

Bookmark this on Delicious REST Logout for WLP with JSP 2.0 EL

June 14th, 2010
No Gravatar

I used to create the log out URL like this:

String    webAppName    = request.getRequestURI().substring(1);
String    webAppPath    = request.getRequestURL().substring(0, request.getRequestURL().indexOf(webAppName));
String    restLogout    = webAppPath+webAppName.substring(0, webAppName.indexOf(‘/’))+”/bea/wlp/api/logout?invalidate_session=true”;

Then, today I needed to have it in a Bighorn skeleton, so I came up with the following:

<c:set var=”webAppName” value=”${fn:substring(pageContext.request.requestURI, 1, fn:length(pageContext.request.requestURI))}” scope=”application” />
<c:set var=”webAppPath” value=”${fn:substring(pageContext.request.requestURL, 0, fn:indexOf(pageContext.request.requestURL, webAppName))}” scope=”application” />
<c:set var=”restLogout” value=”${webAppPath}${fn:substring(webAppName, 0, fn:indexOf(webAppName, ‘/’))}/bea/wlp/api/logout?invalidate_session=true” scope=”application” />

With the URL in hand, you can now make the logout call:

function portalLogOut(restURL)
{
var xmlhttp    = null;
if (window.XMLHttpRequest)// code for IE7, Firefox, Mozilla, etc.
{
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)// code for IE5, IE6
{
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}

if(xmlhttp.overrideMimeType)xmlhttp.overrideMimeType(‘text/xml’);
if (xmlhttp!=null)
{
xmlhttp.open(“POST”,restURL,true);
xmlhttp.send(null);
}
}

  • Share/Bookmark

Bookmark this on Delicious IE OnResize Scripting

June 11th, 2010
No Gravatar

I ran into some ugliness recently setting an iFrame height dynamically where the script would run away on IE.  I found the answer at http://stackoverflow.com/questions/1500312/javascript-onresize-event, posted by Pim Jager.  The resulting combination of the resize and his event handling is as follows:

function getDocHeight()
{
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight));
}

function setIframeHeight(frameId, offset)
{
document.getElementById(frameId).height = (getDocHeight()-offset)+’px’;
}

var resizeIframeTimeOut = null;

var func = function() {setIframeHeight(‘boInfoViewIframe’, 150);};

window.onresize = function(){
if(resizeIframeTimeOut != null) clearTimeout(resizeIframeTimeOut);
setTimeout(func, 100);
};

setIframeHeight(‘boInfoViewIframe’, 150);

One note about resizing elements is that IE will resize again if your new size causes the document size to grow. That was a two hour lesson for me :)

  • Share/Bookmark

Bookmark this on Delicious Early Morning Security Ramblings

June 10th, 2010
No Gravatar

Posting it here for those that don’t belong to LinkedIn or subscribe to Answers there:

Q:  Which Tastes Better for Security, Java or .NET?

Both this two languages are safe by security point of view with their own levels, but which one tastes better w.r.t your working experience?

A:  As others have noted, the security of the individual applications written in these languages depends on the development approach used. The next level from their is the application servers, which really depends on the app server vendor for Java and again back to the developer and the server admin. And, of course, the servers sit inside an operating system, which adds another layer of vulnerability. This is point where the earlier poster who noted that Microsoft is more often the target comes in to play. Microsoft is more often targeted, which increases the likelihood of someone trying to break in. However, the biggest threat is admins and/or policies that prevent keeping up to date on patches. Then there is the architecture as a whole, where there are points in the network, structure of the firewalls and accessibility of data. There are still plenty of admin servers that have the default log in credentials set.

Then again, the vast majority of real digital break ins come from the hacker knowing passwords in advance, which is an issue that is platform independent :)

  • Share/Bookmark

Bookmark this on Delicious JDBC BEA-001129

June 8th, 2010
No Gravatar

If you don’t have a LinkedIn membership, this discussion should be enough reason to sign up (for the record, I did not provide the responses to this question):

Q:

I have a problem in production environment with WebLogic 9.2 mp3.We are using Multi datasource with Oracle 9i RAC two nodes. Database team have maintaince so they took out one node out of RAC. when one of the WebLogic instance associated with connection pool to that RAC node shown the following Warning message and could not start the instance.The multi datasource is configured with algorithm-type as “Load-Balancing”

<Jun 3, 2010 3:12:23 AM EDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
<Jun 3, 2010 3:14:10 AM EDT> <Warning> <JDBC> <BEA-001129> <Received exception while creating connection for pool “DS2″: Io exception: The Network Adapter could not establish the connection>

What are the recommandations to avoid this kind of problems when one of the RAC nodes down and the WebLogic server should have High Availability and scalable?

Any configuration parameters need to set for this??

A:

The way 9.2 mp3 works with RAC is that the multidatasource represents a pool of datasources so if one datasource is not available it will mark that down and use the other datasources configured in the multidatasource. WLS controls the failover, not RAC and this version does not use FAN or FCF.

I assume you have test on reserve set in the connection of all the data sources as that is required to use multdatasource. This parameter is at datasource->connection pool-> advanced

“could not start the instance” means that WLS did not come up??

If you are bringing up a WLS instance without the DB up you may want to set initial connections to 0

  • Share/Bookmark

Bookmark this on Delicious WebLogic Portal (WLP) Lost Samples in 10.3.2

June 3rd, 2010
No Gravatar

Ran across a fun new quirk this morning. To make sure that source control has everything necessary for a build I maintain two workspaces and check the build in one after a check in from the other. There were two errors today. One was just weird, which is that the path of WEB-INF/src somehow became required. Annoying, but no big deal to check it in (and probably could have removed it from org.eclipse.wst.common.component and .classpath without causing an issue).

The quirky part was the second error, which was that it was unable to resolve the reference to “wlp-sample-widgets-web-lib” library. I went to the WebLogic shared libraries in preferences, and sure enough it wasn’t there. Long story short, the sample widgets are not configured in a workspace unless it is added to a project in that workspace. The fix was to remove and then add the facet back in and then OEPE installed it into the workspace.

  • Share/Bookmark

Bookmark this on Delicious WLP Content Presenter Portlet Simplified

May 20th, 2010
No Gravatar

I find the steps at Adding the Content Presenter Portlet to be a bit hard to follow as the content loops back and forth between the sample application and your application, and has frequent references to other documentation where the link goes to the start of the document rather than the specific section necessary for the task at hand. Having always liked reading and writing Quick Start guides, I am posting this one for the WebLogic Portal Content Presenter Portlet. I will later add how to incorporate the inline editing demonstrated in the sample application once I figure it out for myself.

So, first off, I will skip ahead to explain why I start the Quick Start where I do, which is that the templates we will want to add later spit compile errors in OPOE. For that reason, I am creating a separate Portal Web Application that will later be deployed as a shared library. If you don’t need the templates from the sample  app,  you can just use your main application. If you don’t know how to get that far on your own, see the WLP Quick Start and come back here. One other caveat is that you will need a DataSync project associated with the EAR project.

Once you have whatever portal web application that will be Content Presenter enabled chosen, you need to add the necessary facets. Unlike WebLogic Workshop for WLP, you aren’t prompted to add facets when creating the project, so you need to go to the Project Properties after creating the Portal Web Application and add them.

The facet we care about is Content Presenter Framework. It does, however, have some dependencies. Fortunately, OPOE  lets you know what they are:

Adding Facets to WLP

So, rather than list them all out here, just select Content Presenter Framework under WebLogic Portal (Optional) and follow the errors for what to add. One note is that you will want Struts 1.2 instead of 1.3. Otherwise, the default version will do the trick.

To save time, I also selected the Sample Framework Components facet. You will eventually need to build your own log-in portlet, but this should do to get the Content Presenter working.

If you don’t already have one, create a .portal file for your portal web application and add the Sample Login Portlet. You could add the Content Presenter portlet at this time, but unless you are only going to have one in the application you don’t want to as it will be tied to the library instance. By adding it to new desktop  in the Portal Administration Tool (PAT), you will create a separate instance each time.

Create .portal File and Add Login

If you don’t already have some content in your repository to display, once you deploy the portal application go create some as the Content Presenter doesn’t seem to have the facility to create new content (or I haven’t figured it out yet, but if you are reading this then you haven’t either :) ).

With content ready, create a portal and desktop (again, if you haven’t already) and add the content presenter portlet onto a page in the desktop (again, we do this here to have a specific instance):

Add Content Presenter Portlet to Desktop

You will also need to enable Disc on your desktop if you want the sample login portlet to work.

And…

Ta Daaaa!

At this point you can return to the standard documentation at Section 14.2.1, “Configuring the Content Presenter Portlet” for the rest of the steps as it seems to be back on track (for my taste) at that point.

  • Share/Bookmark

Bookmark this on Delicious WebLogic Portal (WLP) Content Presenter Portlet in 10.3.2

May 19th, 2010
No Gravatar

I hope to update this post with a vastly simplified approach to using the content presentation feature. Meanwhile, I do want to point out one thing that had me spinning my time for awhile. The URI for the templates TLDs in the sample files  cause a compile error. At first I thought it was because the URI changed from http://www.bea.com/servers/content/ui/jsp/templates to http://www.bea.com/tags/wlpapps/contentui/templates, so I changed it. Then I got run-time errors because some of the methods aren’t in the new library. So I rolled back to the original values and just turned off validation for JSPs. That worked. So I am taking the approach of putting the templates into a shared library and taking the deployment hit rather than the development hit of having validations turned off for the main branch of the project. Later, I should create a build file that merges the projects at build time and drops the share library reference.

  • Share/Bookmark

Bookmark this on Delicious WebLogic Shared Library Reference

May 18th, 2010
No Gravatar

One of those items I always have to go look up the specifics for is creating the MANIFEST.MF file for WebLogic shared libraries.
Reference URL can be found here.

  • Share/Bookmark

Bookmark this on Delicious Some WLS Apache Proxy Basics

May 13th, 2010
No Gravatar

The proxy plugin configs are a powerful tool for server admins. There was a recent post of the basics at http://weblogic-wonders.com/weblogic/2010/05/13/apache-proxy-as-static-content-repository/ that is worth a boookmark.

  • Share/Bookmark

Bookmark this on Delicious WebLogic Server Session Affinity and Serialization

April 15th, 2010
No Gravatar

I’ve had on my to-do list for awhile now to post about a recent investigation into a WLS  stuck thread issue I fixed. And I still will, as the way I got there is probably more useful to some than the end result. But, someone sent me a question that led straight to the solution today, so I thought I would post the email thread here to benefit my reader:

Q: Can we configure a cluster of WLS that is behind a F5 to use jdbc based persistence without the server affinity defined by load balancer?

A: By persistence, I would assume you mean user session. The limitation is on the applications deployed rather than WLS itself. All objects in session must be serializeable in order for WLS to properly manage persistence, regardless of whether it is database or file or in-memory persistence.

If your client has an issue where session data is lost unless server affinity is maintained it is because persistence has been manually turned off for the application. This is almost always done be developers or vendors when their application does not support serialization.

I’ve run across this situation twice this year. The first time was a sloppy, dishonest vendor (they clearly stated both that their product supported serialization and that they had never tested it…so I did, and it did not) that did not make their session objects serializable. The second time they had issues with a third party application that serialized PDF reports that were generated for a request and they had to turn off persistence to keep the disks from filling up every quarter.

  • Share/Bookmark