Two gotchas installing a Java Runtime manually

Having spent some time deploying instances of Java for Solr servers recently, I came across two things that wasted my time. So…

Issue 1: Downloads for OpenJDK

Since Oracle started demanding license fees for use of their main java builds, I find myself having to deploy the OpenJDK builds much more often. It’s usually the v1.8 JDK/JRE you need, as that’s what’s supported by Solr, and that’s available from GitHub at: (Ignore the “debug” ones)

You can pick the approriate release from there, and click through to get the list of downloadable files to choose from. If you’re downloading manually, you can just pick the archive you need – but if you’re automating it you have to be a bit careful. My initial thought was:

Start-BitsTransfer "" ""

But that doesn’t work:

Start-BitsTransfer : The resource loader cache doesn't have loaded MUI entry. (Exception from HRESULT: 0x80073B01)
At line:1 char:1
+ Start-BitsTransfer " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Start-BitsTransfer], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.BackgroundIntelligentTransfer.Management.NewBitsTransferCommand

After a lot of tedious googling, it turns out GitHub hosts downloads in Amazon’s cloud, and that involves some redirects that don’t play nicely with BITS transfers

So – BITS is out, unless you’re able to mess with system-level settings. And, you probably don’t. So it’s simpler to stick with a simple web request:

Invoke-WebRequest "" -OutFile ""

That will get you your download without any pesky errors…

Issue 2: Getting your Environment variables right

Configuring and running SolrCloud code requires assorted bits of Java to run – and it turns out that different bits of the setup process make different assumptions about how the runtime gets found. And it’s your environment variables that control this. The main Solr search engine seems happy with just #1 below, but aspects of configuring ZooKeeper don’t seem to work quite the same way. So if you don’t configure both of these, you can end up with odd “can’t find java” related errors while you’re trying to configure your cluster…

So if you’re not using an installer for Java, you have to make two key settings for SolrCloud to be happy:

  1. Set the “JAVA_HOME” environment variable is set
  2. Add the your JRE’s “BIN” folder to the path

For both of these, you need to take note of scope. Make sure you understand whether you are (or want to) be setting them for the current user, or for the system overall. Generally, if you’re running stuff as a service, you need the environment variables it depends on set in system scope, so they’re available when the code is not running as your user. And remember that changes to environment variables are not automatically reflected in any other windows you have open already – so you may need to re-open stuff, or reboot to make sure everything ends up in the state you want.

For the “JAVA_HOME” variable, you need to make sure it points to the JRE folder. If you downloaded the Java JDK then this is a child folder of what you unzipped. But if you only downloaded the JRE package then the environment variable needs to point to the folder you’ve extracted. In both cases, the bin folder you’re adding to your path is a child of the JRE folder.

If you download the “JRE only” archive then that looks like:

But if you pick the “full JDK” one then the JRE one here will have siblings containing all the other bits of the JDK. (And it will just be called “JRE” rather than having the full release name)


Bonus chatter: What will you be doing at Symposium, Jeremy?

It’s only a few weeks until Sitecore Symposium kicks off for this year. My presentation is taking shape nicely (more of that later) but I’ve also been considering what I’ll be watching from the rest of the conference… So if you’re looking for inspiration, or still on the fence about buying yourself a ticket, here’s what I’m looking forward to around this year’s event: Continue reading

Reformatting config XML so it’s easier to diff

Every so often pretty much every developer ends up in a situation where they’re looking at a bug that manifests on one platform, but not on another. The sort of bug where you end up spending hours looking through log and config files for a subtle difference. I found myself looking into just this sort of bug recently, but on a site where (to my frustration) the config files were full of comments and whitespace differences across platforms that made diffing really hard**. Spotting that subtle bug-causing difference is pretty much impossible when your diff is full of noise… So how can we fix that? Continue reading

Caching when you have duplicate container components

In theory, the magic of Dynamic Placeholders lets us have a container component placed onto your page more than once. That didn’t work in the old world of “static” placeholders, because the rendering engine didn’t like two placeholders with the same name. But despite it’s benefits, the dynamic implementation has an annoying edge case – you may not be able to enable caching for your container component. I had a client bump into this issue recently, so I spent some time considering approaches that might help them address this issue. Continue reading

An edge case of remote events with Publishing Service

I’ve been working on an international deployment of Sitecore recently, and resolving some problems around how publishing raises remote events has demonstrated that there are some things about the publishing process that I didn’t entirely understand… I doubt this is a common scenario, but it still seems worth writing down what I’ve learned – So here’s another crib sheet for my future self: Continue reading

Clearing up a little confusion with Let’s Encrypt’s DNS challenges

I love Let’s Encrypt. I’ve been using SSL for all my personal projects for years. Until they came along I was using self-signed certificates and manually adding my own root certificate to all the machines I was using my sites from. And that lead to some fun… So I moved eagerly to Let’s Encrypt when the tooling supported Windows reasonably well, and set myself up with a certificate with multiple SANs authenticated via their “HTTP proofs” mechanism, and it all worked fine, despite it being a bit of a pain that I had to expose port 80 for sites I only wanted accessible via port 443.

But I realised recently that they now offer wildcard certs that would make my life simpler, and that there is now decent support for DNS-based proof-of-ownership. So recently I tried moving my server over to this model – and there was a bit of friction. Entirely PEBCAK though – so I’m writing this down for the next time I forget how DNS works 😉 Continue reading

Bonus chatter: I can’t let my 200th post pass without comment…

When I wrote my first blog post here** in February 2014 I definitely did not imagine still being at it 200 posts and five-and-a-bit years later. Originally I set myself a challenge of writing something once a week for a year, just to see if I could motivate myself to do it.

Honestly, I didn’t really think I’d manage to keep it up for the entire twelve months, let alone still be here now – but somehow it’s become part of my routine. I may have scaled down to a post every fortnight, as kids and other responsibilities took over more of my time, but the process of making myself notes about issues I encounter as I’m working, and then writing them up when I have free moments has become part of my working life now… Continue reading