Websphere unable to check if application exists

I’m still fairly new to Websphere, but this seemed like a pretty common problem someone would have and I couldn’t find anything that properly explained the issue to me. I was running into an issue where WebSphere kept saying it was unable to check if application exists when it was being deployed. I thought initially this was a permissions problem, so I fooled around with permissions but had the same issue. If you scroll down a ways on the stack trace it says

insufficient or empty credentials

I double checked my configuration in Hudson/Jenkins and testing the connection worked fine, so I continued searching for other solutions. There are literally 3 search results on google for “unable to check if application exists” and 0 results on bing. Most of the other articles I found offered no help. Eventually I circled back around and decided to look at the access level my user had in WebSphere. Turns out it wasn’t listed as a user! I’m still not sure how testing the connection in Hudson worked but I wasn’t listed as a user in WebSphere. I checked this half a dozen times just to make sure I wasn’t mistaken.

To add a user in WebSphere

  1. Users and Groups
  2. Administrative user roles
  3. Select the Administrator role
  4. Enter the user to search for
  5. Use the arrow to move the user to the Mapped to role box
  6. Click OK
  7. Click Save

Step 7 is super important because it requires an additional save than most programs do and I find myself forgetting to do the second confirmation too often. After you’ve added the appropriate permissions redeploy your ear and you should be all set.

Full stack trace of the error I was getting

[INFO] No custom module-to-server mappings found — using default configuration.
com.insertcompanynamehere.websphere.deployment.client.DeploymentException: Unable to check if application exists ‘NewBusiness’
at com.insertcompanynamehere.websphere.deployment.client.was61.DeploymentManager.applicationExists(DeploymentManager.java:265)
at com.insertcompanynamehere.websphere.deployment.WebsphereDeploymentTask.execute(WebsphereDeploymentTask.java:59)
at com.insertcompanynamehere.hudson.plugin.WebSphereDeploymentBuilder.perform(WebSphereDeploymentBuilder.java:194)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
at hudson.model.Run.execute(Run.java:1743)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: com.ibm.websphere.management.exception.AdminException:
at com.ibm.websphere.management.application.AppManagementProxy.proxyInvoke(AppManagementProxy.java:189)
at com.ibm.websphere.management.application.AppManagementProxy.checkIfAppExists(AppManagementProxy.java:266)
at com.insertcompanynamehere.websphere.deployment.client.was61.DeploymentManager.applicationExists(DeploymentManager.java:263)
… 11 more
Caused by: javax.management.JMRuntimeException: ADMN0022E: Access is denied for the checkIfAppExists operation on AppManagement MBean because of insufficient or empty credentials.
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.handleAdminFault(SOAPConnectorClient.java:948)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplateOnce(SOAPConnectorClient.java:916)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:682)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:672)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:658)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:480)
at $Proxy43.invoke(Unknown Source)
at com.ibm.ws.management.AdminClientImpl.invoke(AdminClientImpl.java:224)
at com.ibm.websphere.management.application.AppManagementProxy.proxyInvoke(AppManagementProxy.java:183)
… 13 more
Build step ‘IBM WebSphere v8.0 Deployment’ changed build result to FAILURE
Finished: FAILURE

Enabling offline mode in Google Chrome

In April and May I was traveling every other week for work and to keep myself occupied I would open a bunch of articles in chrome on my phone to read them on the plane. Much to my chagrin the first time I did this about half the articles were automatically reloaded by chrome and I wasn’t able to read them because I didn’t have an internet connection. I started trying to fix this by looking for a way to disable the setting that would reload tabs, but was unsuccessful. What I did find was an option to reload an article from the cache if you were offline.

Simply type chrome://flags into your address bar and find the Enable Show Saved Copy Button setting.

Enable Show Saved Copy Button Mac, Windows, Linux, Chrome OS, Android setting.
When a page fails to load, if a stale copy of the page exists in the browser cache, a button will be presented to allow the user to load that stale copy. The primary enabling choice puts the button in the most salient position on the error page; the secondary enabling choice puts it secondary to the reload button. #show-saved-copy

You can enable this setting as a primary or secondary button. Primary will enable this setting as the most noticeable option when you’re offline and secondary will make it the secondary option to reloading the page.

Before I found this setting I stumbled upon Pocket which is a much better option for saving articles overall, but won’t help you recall a webpage you visited earlier. The other downside to pocket is it’s much easier to forget about than an open tab and you’ll probably let articles sit in their forever before you read them.

Hard refreshing in Google Chrome

All of us are probably familiar with ctrl + F5 to hard refresh a page but I ran into a cool feature in Chrome today that will save you a second or two if your hand is already on the mouse. If you have the console open and long press on the refresh button you’re given three options

  1. Normal Reload
  2. Hard Reload
  3. Empty Cache and Hard Reload

You can already disable cache while the console is open but this option will empty the entire cache and re-download everything on the current page. The difference is if the current website has content loaded through a CDN this will force a re-download of that content.

chromerefresh

Aligning monitors vertically in Windows

At work I have dual monitors but with my docking station can also use my laptop as a 3rd monitor which is great. The thing that always annoyed me was my laptop was my third monitor and was located all the way to the right, so to get to it I had to mouse all the way to the right. A minor annoyance for the convenience of having 3 monitors. I mentioned something to someone about this the other day and they asked why I didn’t position my laptop monitor as below the dual monitors and I said “I would if I could”. Then I opened up the monitor control panel and tried to drag the monitor below and lo and behold it worked! I’m not sure why I never thought of this before as it seems so obvious now.

This would also work if you have one external monitor positioned directly above your laptop. Rather than scrolling to the right to get to the 2nd screen you can scroll verticallywhich is a lot more intuitive. This works with the Intel Control Panel and also with the GeForce Experience Control Panel.

3 monitors 1 below

 

Groovy, Grails and Responsive Web Design Stack Overflow

I’ve taken inspiration from Stephen Moretti and his CFOverflow twitter account and started twitter accounts for Groovy, Grails and Responsive Web Design that post the latest questions on each topic from Stack Overflow. For Groovy it posts the latest questions tagged Groovy and the same goes for Grails. I originally set these up as just one feed, but the questions coming in to the two feeds don’t really overlap as much as I thought they might so I decided to split them into two accounts.

For the Responsive Web Design account the latest Stack Overflow posts tagged “media queries” or “responsive design” are posted.

Stephen said he added some filters to prevent duplicates from posting, but I haven’t done that yet. If duplicates start showing up in the feeds I will take a look at the filters.

If anyone thinks other feeds should be added to these accounts let me know and I can get them added. Any feedback at all in appreciated

Groovy questions
Grails questions
Responsive Web Design questions

Registration for Iowa Code Camp is now open!

Registration for Iowa Code Camp is now open. The event is completely free for anyone who wants to attend and includes breakfast and lunch onsite and also an after party hosted by Robert Half Technology.

The event is Saturday, May 9th from 8 am to 5:30 pm at the Hotel Kirkwood in Cedar Rapids. There will be 5 blocks of sessions with 7 sessions going on at a time, so you’re sure to find something you want to attend during each time slot.

There are 100, 200 and even a few 300 level sessions covering topics such as Agile methodologies, DevOps, Ember, Git, Go, Kafka, R and Responsive Web Design. If you attended Iowa Code Camp last November in Ankeny there are many speakers who presented that are presenting again this year on different topics.

I’m speaking at Iowa Code Camp!

I’m happy to announce I’ve been selected to speak at Iowa Code Camp, May 9, 2015 at The Hotel Kirkwood in Cedar Rapids. If you’re interested in attending the cost is absolutely free for anyone wanting to attend and registration will be open shortly. I’ll have a follow up post once registration is open.

I will be speaking about Responsible Responsive Web Design. In the 75 minute talk I’ll be covering what responsive design is and how to build a website using it. I’ll also cover how to design a responsive website responsibly – How you can delivery a consistent user experience to users on small and large screen devices and how to decrease your website’s page size quickly and effectively to make your website load fast even on slow internet connections. Lastly, I’ll cover how to use the newest HTML5 specifications even on browsers that do not have native support.

A big thanks goes out to Scott Jehl, who wrote the book Responsible Responsive Design that inspired this talk.

Checking an HTML page for duplicate IDs using JavaScript

A couple years back I wrote a post about Checking an HTML page for duplicate IDs using jQuery. A pretty useful tool when you need to ensure IDs on a page are unique. The downside to that code was that it required jQuery and the app I’m currently working with does not use jQuery, so I modifed the existing code to write a pure JavaScript solution that does the same thing.

var allElements = document.getElementsByTagName("*");
var allIds = {};
var found = false;
for (var i = 0, n = allElements.length; i < n; ++i) {
  var id = allElements[i].id;
  if (id) {
    if (allIds[id] === undefined) {
      allIds[id] = 1;
    } else {
      found = true;
      console.warn('Duplicate ID #' + id);
    }
  }
}
if (!found) {
  console.log('No duplicate IDs found');
}

All you need to do is create a new bookmark with the following as the URL

javascript: (function() {var allElements = document.getElementsByTagName('*');var allIds = {};var found = false;for (var i = 0, n = allElements.length; i < n; ++i) {var id = allElements[i].id;if (id) {if (allIds[id] === undefined) {allIds[id] = 1;} else {found = true;console.warn('Duplicate ID #' + id);}}}if (!found) {console.log('No duplicate IDs found');}})();

Or you can simply drag the bookmarklet below onto your bookmark toolbar

Duplicate ID Checker

Update: Ryan Guill let me know he wrote something similar and he’s saved it as a Gist. It’s interesting seeing the different approaches to accomplish the same thing.

Firefox Open Pop Ups as Tabs

We have an application at work that was built for IE 5.5, so this may have made sense at some point, but it opens up 3 new windows before you actually get to the useful part of the application. In Chrome you can right click on the title bar and choose “Show as Tab”, but Firefox doesn’t have that option. Thankfully there’s an about:config setting you can change to force all pop ups to render into a tab rather than a new window.

If you’re not familiar with about:config simply type about:config into the address bar and hit go, just like it’s a normal url. You will likely get a warning about “voiding your warranty”. Click “I’ll be careful, I promise!” and the search for newwindow. You will see an entry with a Preference Name of “browser.link.open_newwindow.restriction” and a value of 2. Change that value to 0 and all pop ups will open as tabs.

newwindow

Adding the stack trace to a Java Server Page error page

I’ve recently been switched to a Java project and one of the most frustrating parts of the application (other than barely knowing Java) is the error page would only show a “An error as occurred” message and not the actual stack trace. In production this is a perfectly valid scenario, but when developing having to go back to RAD and scroll through the console to find the error message was wasting a lot of time, so after a decent amount of googling I found a way to dump the stack trace to the page.

The code ended up looking like this. In the message board post they used exception instead of error, but hopefully you get the point.

<jsp:useBean id="error" scope="request" class="java.lang.Throwable" />
  <%
    Object billingError = request.getSession().getAttribute(RequestParamConstants.UNKNOWN_BILLING_ERROR);
    error = (Throwable)billingError;
  %>
  <%@page isErrorPage="true" import="java.io.*"%>
  <pre>
    <%
      error.printStackTrace(new PrintWriter(out));
    %>
  </pre>

A while after implementing this I ran into an error where the first line was about 400 characters long, so I had to scroll way over to the right. This is because by default the pre tag does not wrap, so I added this simple css fix which allows the pre tag to wrap

pre { white-space: pre-wrap;}