Skip to main content

Posts

oAuth2 404 Error on Redirect - Google and an Angular2 app

Issue Encountered: Could never properly redirect back to our Angular2 application after successful social based authentication. We were encountering a 404 (file not found) redirect issue in an Angular2 app after successfully authenticating via Google oAuth login.  I was running my Angular application on Tomcat 9 and had the app running under an application context and not in the root (default-context> of the server.  For example /example-application/index.html.  The problem was the oAuth callback success url was set to /example-application/social-login-success?token= and you would just always get back a 404 error because the application/web server (Tomcat) was not able to retrieve a file at that location.  That url is actually an Angular route that the angular router needs to handle, but the router was never being reached. Solution:   Add a redirect at the tomcat level.     1) Create a WEB-INF folder at location of your application root <Tomcat-root>/<example-app
Recent posts

Swag your Swagger

Document your REST API with Swagger Swagger is a great tool to allow you do document your REST based APIs and provides an interactive sandbox for clients or testers to interact with the API.  Certainly go and check out what Swagger has to offer at  Swagger.io  . However as I found as of 2016, most of the examples available on the web regarding how to get Swagger up and running details what to do when you are using Spring-boot.  Therefore I'm providing my write up to assist anyone who is trying to make swagger available form a SpringMVC application.  I had a surprising level of pain getting it to work, considering the lack of details regarding specifics for this type of application. As is becoming common in my posts, I will first provide you a quick summary of the stack (tools/framework in play).  Things are constantly evolving and you will need to assess your frameworks and version versus what I used in May of 2016. Prerequisite stack: Spring-core 4.2.4-RELEASE Spring-

Where to start on AngularJS for Java Developer

Background: If you are a Java developer who is comfortable using Eclipse (JEE Developer version) you may be asking yourself where to start with AngularJS. There is all kinds of documentation out there in regards to AngularJS and https://angularjs.org/ provides, to the point, tutorials on how to get started. You can certainly go that route and use node.js embedded server and possibly a Javascript focused IDE like WebStorm. However I wanted to try and stay in a comfort zone, my comfort zone, of Eclipse and be in a position to deploy an Angular application to a container like Tomcat. This blog entry will present the trail I took to try and accomplish it. Note: This is an adventure into Angular 1.x, not 2.x.  I would imagine this could all work with 2.x as well as it is focused on the dev environment setup. Start: Well the one consistent thing you will find to get started is to install the AngularJS Plugin, provided by Angelo ZERR.  You can use the Eclipse 4.5 (Mars) plugin inst

MAC SVN to GIT

Atlasssian provides a wonderful tutorial on how to use their migration scripts to move your subversion code repos to their BitBucket Git Repository  https://www.atlassian.com/git/tutorials/migrating-overview  . However their are a few things that all developers inevitable run into that are not explicitly documented.  I figured I would document the few things I ran into during my migration process and maybe save a few other developers a few moments. Tip 1: Re-mounting sparseimage I was undertaking my migration from MAC OS X (Yosemite).  Since the MAC OS is a case insensitive OS, I had to follow the instructions provided in the Atlasssian Migration guide to "Mount a case-sensitive disk image".  It worked great except of course I had to abandon my efforts and come back the next day.  Well the mount point was gone after I exited my terminal session.  The sparse image still existed. In order to remount the sparseimage I had to use the hdiutil. cd ~ hdiutil attach ~/GitMig

Database Leak: getConnection() within Spring Transaction

I recently encountered an issue where one of my teammates was experiencing an issue where an application datasource would periodically become exhausted.  After discussing it a few times, we hypothesized that it was a situation where there was a database connection leak.  It was suspected the leak was within boundaries of some application code with a low call rate.  This would line up with, why the application would run for an extended period and then all of a sudden max out its database connections. By inspecting the logs around the times of the database connection pool becoming exhausted it became pretty clear the potential location of the problematic code. The cause of the issue was not a result of necessarily bad code writing, but more of a case of not knowing how legacy semantics would work within the context of a spring transactional boundary. The semantics of how a call to DataSource.getConnection() behaves within the Spring transaction boundary is probably not entirely evide
Dripping Faucets and Memory Leaks All Java developers will need to deal with memory leaks at some point in their careers.  There are already numerous blog posts on the internet about developers' experiences.  I figured I wold just add another, which discusses the trial and tribulations of my latest ordeal with a leaky faucet. We encountered a situation where a long running application server infrastructure all of sudden started to experience sever unreliability issues.  The application servers were starting to crash numerous times a day.  The application server was Oracle's old OC4J J2EE container, however that is really irrelevant in this case.  The application change would have caused issues on any application server platforms. Initial Pipe Tightening This particular matter was made a little more convoluted by the fact that there are actually multiple applications running in the same container.  One of the applications was a historical memory hungry application which

Upgrading to xCode 6.4

After you upgrade to xCode 6.4 you will notice that the SDK for iOS 7.1 is no longer available. If you still want to be able to build for iOS7 and run a simulator for iOS7 then you will need to do a little bit of manual work. First if you go to Preferences --> Downloads within xCode you should see a component listed for the iOS 7.1 simulator.  Click on the download arrow in order for it to be downloaded and installed. However you will notice that there is no download for the base SDK for 7.1.  You will need to manually install it in order for it to be available to xCode 6.4. You will want to check and confirm what SDKs are actually installed.  You can check by opening a terminal on your MAC and then proceeding to the directory /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs . If you do not see a folder for iPhoneOS7.1.sdk you will want to extract a copy of the SDK into your Xcode SDK directory structure.  You could either attempt to cop