Weblogic, 1 managed server gives HTTP Error 401 Unauthorized, other works fine.

I encountered this weird behaviour last week where one managed server in a cluster of two servers constantly gave the error “HTTP Error 401 Unauthorized“.
The setup was a standard Oracle Service Bus installation on Oracle Weblogic.
The domain consisted out of one Admin server, one cluster with two managed servers.
Managed Server #1 was acting without problems but all the requests which needed authentication and which where pointed to Managed Server #2 failed and responded with a 401 Unauthorized message.
There was an error in the logs of MS#2, which is displayed at the bottom of this post as well.
#### <> <Inbound http BASIC authentication failed
javax.security.auth.login.FailedLoginException: [Security:090304]Authentication Failed: User webhosting javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User webhosting denied

The solution to this problem lies in the internal LDAP configuration of the faulty Managed Server. I did not find an answer to what might have caused this problem, but the solution was to rebuild the LDAP setting of the Managed Server.
This is done by following these steps:

  1. Shut down Managed Server via Weblogic Console
  2. Log in via SSH
  3. Rename the following folder: %domain_directory%/servers/%osb_managed_server_1%/data/ldap
  4. Start the Managed Server via Weblogic Console

These steps will rebuild the LDAP folder, which is the internal LDAP to which Weblogic authenticates.
You can then remove the folder you’ve backed up in step 3.
Continue reading “Weblogic, 1 managed server gives HTTP Error 401 Unauthorized, other works fine.”

Find Java JRE location on Ubuntu Linux

Everybody knows that the java executable is located in /usr/bin/java , but what if you need the JDK / JRE location itself?
Just using “whereis” will not get you there, that will point you to the /usr/bin/java point.
joris@howlingmad: ~_011
 
So, let’s find out a but more about /usr/bin/java:

ls -l /usr/bin |grep java

joris@howlingmad: ~_012
 
Awesome, this will lead us somewhere, it’s a symlink to /etc/alternatives/java
So let’s do the same there:

ls -l /etc/alternatives/ |grep java

And we’ve hit the jackpot, among the lines here, there’s a bunch of lines pointing us to the JRE location:
joris@howlingmad: ~_013
 
As you can see in the screenshit, our java executable within the JRE location is:

/usr/lib/jvm/java-7-oracle/jre/bin/java

Which means the JRE location is:

/usr/lib/jvm/java-7-oracle/jre

 
 
 

SSH: Different settings (keys!) for different hosts

There’s a simple way to create aliases in a SSH config file. This way you can connect way easier to different hosts, combined with this blog post to use keys to log in.
Where you used to use this connect string:

ssh pi@192.168.0.5
pi@192.168.0.5's password: <<enter boresome password>>

You can now just enter

ssh pi

Where “pi” is the alias that you’ll be using!
The only thing you’ll need to do is create the following file:
[[ ~/.ssh/config ]]

Host pi
  HostName 192.168.0.5
  User pi
  << (!) Only add below line if you're using keys to log in >>
  IdentityFile ~/.ssh/keys/raspberry_key

Aint that awesome!?
Ps. If you’re still being asked to enter your password, check your keys and please look at this blog post I wrote.
 

Cygwin – Your group is currently mkpasswd

This message occurs every time you start your freshly installed Cygwin when you’re logged in as a domain user.

Your group is currently "mkpasswd".  This indicates that your
gid is not in /etc/group and your uid is not in /etc/passwd.
The /etc/passwd (and possibly /etc/group) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l [-d] >> /etc/passwd
mkgroup  -l [-d] >> /etc/group
Note that the -d switch is necessary for domain users.

Important: You need to install Cygwin with the user you are logged in with.
Tip
: Remove the word “setup” from the cygwin executable to be able to install it without administrator privileges. (e.g. setup-x64.exe should be renamed to cygwin-x64.exe)

  • mkpasswd -l only shows my local users, and not the domain user I’m logged in with, so that does not solve this.
  • mkpasswd -l -d get an enormous amount of users because it tries to replicate my whole organisation, which is not necessary.

We just need our current user ( mkpasswd -c ) to be sent to the /etc/passwd and /etc/group files, to do this, we use this command:

Solution:

mkpasswd -c >> /etc/passwd
mkgroup -c >> /etc/group

After that, our current account is added to both /etc/passwd and /etc/group and the annoying greeting message is gone!

Authentication – Subversion on command line will not remember credentials

I ran into this issue today on my command line SVN client.
Every time I ran the SVN command against my repository, it asks for my password. It does remember the username but doesn’t store the password.
There are a couple of settings to check in two different files:

  • .subversion/config
  • .subversion/servers

.subversion/config

The config file contains a setting which sets the password store you will be using. We need to disable all password stores and use an empty list, which is done by uncommenting (or adding) the next line

password-stores =

.subversion/servers

The servers file contains settings which allow you to save your passwords in general and to save the passwords in plaintext (please be careful when choosing this option!)
This file is divided in sections which are set with the [] brackets. In the [global] group you should uncomment (or add) the following lines:

store-passwords = yes
store-plaintext-passwords = yes

See which SVN user editted which line

This is one quite cool trick where you can see which edit’s were done to a file by which user:
Issue the following command on a file which is checked in to SVN:

svn blame filename

Which will output the following syntax:

revision <tab> username <tab> line in filecontents

Please look at this example :

21672 jvisscher   declare namespace urn = "namespace:customer:v01";
21672 jvisscher   declare namespace urn1 ="namespace:customer:v01";
21673 mycolleague declare namespace urn2 = "namespace:v01";
21673 mycolleague declare namespace urn3 = "namespace:v01";
21674 mycolleague declare namespace urn4 = "namespace:v01";

Awesome! Now I can quickly see that my colleague was the cause of my failing namespace!
As a sidenote: I really like the function’s name, because most of the time, you’re looking to blame someone 😉

Schema size in Oracle DB

I’ve been running out of disk space on my virtual machine and didn’t want to mount another volume to add more room (because the problem isn’t more room; it’s that I’m sloppy with disk space) 🙂
So I was looking around on how to easily query for the schema size to find out which little project of mine was taking up way too much room. I found a nice solution on this blog:

SELECT tablespace_name
 , SUM(bytes)/1024/1024 AS total_size_mb
 FROM dba_segments
 WHERE owner = Upper('&User_Name')
 GROUP BY owner
 , rollup(tablespace_name);

When you run the query it’ll ask you which user you want to check:

Screenshot - SQL Developer - Query for schema size
Screenshot – SQL Developer – Query for schema size