Categories
Uncategorized

Upgrade from Ubuntu 11.04 to 11.10, and a pleasant user interface greets you. Does the good news end there?

UPDATE (18th Nov, 2011): I carried out a clean installation from a USB drive, and no longer have the purple/blank screen problem while loading the 3.0.0-12-generic kernel. I can conclude that a problematic web upgrade process prevented the newer kernel from loading. Possible fixes are being discussed on various forums, but none of them have worked for me.

I’ve been running Ubuntu 11.04 (Natty Narwhal) for several months and have been satisfied with the experience. In October 2011, the newest stable Ubuntu 11.10 version (Oneiric Ocelot) was announced.

The upgrade to the new distro can be carried out by running the command:

sudo do-release-upgrade

You could also enable automatic updates, like I did, and have Natty Narwhal prompt you to upgrade. Simply go to System -> Administration -> Update Manager, click on the ‘Settings…’ button, and in the ‘Updates’ tab, turn on the checkbox for automatic updates. Also ensure that the release upgrade option is set to “Normal releases”.

To me, it was a surprise that I didn’t have to go to fetch Ubuntu 11.10 or run a command to get it – it came straight to me!

Welcome to Ubuntu 11.10 Oneiric Ocelot

Fast and easy install? Well, the upgrade certainly did not go on unattended and repeatedly questioned me about replacing some old configuration files.

My machine, incidentally, isn’t so dated – it runs an AMD Athlon X2 2.5 GHz processor with 2 GB RAM and an Nvidia GeForce7050PV graphics card.

After a lengthy download of over 850 MB – the size may vary for you, depending on the number of packages needed – and an install process which wasn’t without hiccups, I had to restart, only to find a blank purple screen and no hard disk activity.

Enough to cause my heart to sink.

Doing a hard reboot took me to a menu with a list of options to choose from:

  1. Ubuntu, with Linux 3.0.0-12-generic
  2. Ubuntu, with Linux 3.0.0-12-generic (recovery mode)
  3. Previous Linux versions
  4. Memory test (memtest86+)
  5. Memory test (memtest86+, serial console 115200)

If I’d choose the first option, I’d be back to square one. Choosing the second option would result in a kernel panic.

I went to “Previous Linux versions” and found these options:

  1. Ubuntu, with Linux 2.6.38-8-generic
  2. Ubuntu, with Linux 2.6.38-8-generic (recovery mode)

I chose the first one and was greeted by a glossy LightDM login screen, followed by a beautiful new Ubuntu desktop.

An Exciting New Linux – But not everything’s Smooth Sailing

It turned out that Ubuntu 11.10 was failing to load the new Linux 3.0.0-12-generic kernel. I decided to install the startup manager from the synaptic package manager, and set the default operating system to the older Linux 2.6.38-8-generic to allow my system to function.

Startup Manager

A big thank you to the posters discussing this issue on the thread that helped me!

As for the user interface, much of it is revamped. The action of dragging and docking folders is nicely animated. My Atheros chip based Wi-Fi adapter now connects me to the Internet almost instantly, unlike the case with Natty Narwhal, where I had to wait for several tens of seconds before connectivity would be established. The processes of both starting up and shutting down the computer take only slightly longer.

There’s a prominent launcher that appears when hovering the cursor on the left side of the screen, to help you open your favorite application almost instantly.

Clicking the dash on the top-left corner reveals a translucent box to help navigate to various parts of your machine fairly fast. There’s a Mac OSX-style spotlight for instant searches. However, critics are furious that Ubuntu is trying a lame copy of Mac’s stunning user interface and falling short.

Accessing the most frequently used and other installed applications through the dash was never easier, not least due to the Filters feature that is clearly a leap over the basic offerings of Ubuntu 11.04.

Ubuntu 11.10 Desktop

What worries me is that the dash once became unstable and disappeared.

Switching applications is facilitated by pressing either the Alt+Tab or Alt+Grave buttons and choosing a running program from a frosted-glass box. However, this seems to cause my computer to hang after using it for several seconds, calling for a hard reboot.

I haven’t really tried many of the applications that came pre-bundled with Ubuntu 11.04 or were available for download, since I spend most of my time on the Internet. The few I did try from the math, engineering and graphic designing sections failed to impress me, and I won’t be surprised if Ubuntu 11.10 is not very different on this front.

The Conclusion?

Well, there still seem to be issues that Canonical has to address. Ubuntu 11.10 with its default Unity interface surely has an unprecedented, elegant look and feel. But there’s got to be more than skin-deep beauty – Canonical should definitely have done better testing on the upgrade process and its end result.

Categories
Uncategorized

How to enable Java in Chrome and Firefox on Ubuntu

To enable Oracle’s Java plugin in your Linux browsers, just copy these lines into a script, and run it!

JAVA_HOME=/usr/lib/jvm/jdk1.7.0
MOZILLA_HOME=~/.mozilla
mkdir $MOZILLA_HOME/plugins
ln -s $JAVA_HOME/jre/lib/i386/libnpjp2.so $MOZILLA_HOME/plugins

Note: You may need to change the value of JAVA_HOME so that it correctly points to your installation of the JDK. 64-bit users will need to change the final line to:
ln -s $JAVA_HOME/jre/lib/amd64/libnpjp2.so $MOZILLA_HOME/plugins

If you’re a newbie, here’s how to run the script:

  1. Using your favorite editor, paste the contents of the script into a new file.
  2. Find out where Oracle Java is installed. This location has the directories “bin”, “lib”, and “jre”, among others. Replace the value of JAVA_HOME with the path to this folder, and save the file. This step applies if you’re using the JDK. If you’re only using the JRE, let JAVA_HOME point to the jre installation directory (which contains the folders “bin”, “lib” and “plugin”), and modify the last line in the script to remove “jre” from the path.
  3. Make the script executable, by typing in chmod +x <filename>
  4. Run the script using the command ./<filename>
  5. Restart your browser, and confirm your installation as shown in the next section

The above script will enable Java support in both Chrome/Chromium and Firefox, since they both use the ~/.mozilla/plugins directory to scan for available plugins.

Confirming Installation

After you’ve restarted your browser, if you see a message below detailing your installed Java version and operating system, you’ll know it’s working successfully.

You can also look up the address “about:plugins” in Chrome or Firefox to get the list of plugins installed in your browser.

Alternatively, look up Oracle’s How do I test whether Java is working on my computer? to confirm the version of Java your browser is using.

Troubleshooting

If you’re facing problems with your Java plugin not working correctly on certain sites, you might want to try updating Java to the latest version. Also, you could try switching to Oracle’s version (in case you’re running the OpenJRE or IBM’s JRE), since that’s what’s best supported on the web.

Categories
Uncategorized

Attacking a Weird Java Error: java.lang.ClassFormatError: Invalid pc in line number table

While working on the Oracle Application Framework, my Application module’s class file was behaving in a strange manner. When it was deployed on Apache and run, it was throwing the following Error:


oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.ClassFormatError, msg=oracle/apps/fnd/framework/test/updateAMImpl (Invalid pc in line number table)
at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:1619)
at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:2366)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:427)
at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:214)
at oracle.apps.fnd.framework.webui.OAHttpSessionCookieImpl.useApplicationModule(OAHttpSessionCookieImpl.java:473)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:398)

I Googled on this error a lot, but most of the suggested solutions spoke about compiling the class with a different JDK or a different Java version and deploying it again. I tried to do that, but the error persisted.

Decompiling using javap

I thought of decompiling the deployed class using the javap utility – if it would fail to decompile, that would surely indicate a problem with the class itself. However, javap decompiled it correctly, and correctly displayed public methods of the class.

I glanced through the help of javap (using -help), trying to figure out how to get a peek at the private methods too. While doing that, I noticed an interesting option: -verbose. This disassembles the code, and also prints the stack and line number table. Intrigued, I tried to run:

D:\JDeveloper\jdevhome\jdev\myclasses>javap -verbose oracle.apps.fnd.framework.test.UploadAMImpl > detailedclassUploadAMImpl

and it displayed the following (for the sake of brevity, I’ve pasted only relevant sections):


 170: invokestatic #92; //Method oracle/apps/fnd/framework/OAException.wrapperException:(Ljava/lang/Exception;)Loracle/apps/fnd/framework/OAException;
 173: athrow
 174: astore 11
 176: jsr 182
 179: aload 11
 181: athrow
 182: astore 12
 184: iload 7
 186: invokestatic #88; //Method java/lang/String.valueOf:(I)Ljava/lang/String;
 189: astore 8
 191: aload 8
 193: areturn
Exception table:
    from    to    target    type
   77   148   154   Class java/sql/SQLException

156 163 166 Class java/lang/Exception

77 174 174 any LineNumberTable: line 150: 0 line 151: 8 line 152: 14 line 153: 39 line 154: 58 line 155: 70 line 156: 73 line 158: 77 line 159: 86 line 160: 95 line 161: 104 line 162: 112 line 163: 122 line 164: 141 line 165: 154 line 167: 156 line 168: 166 line 169: 168 line 170: 174 line 171: 184 line 172: 191 line 174: 193 line 173: 194

Looking at the line number table and disassembled code, I didn’t get anything conclusive. Then I just tried the same stuff on another class which was not having the same problem:


D:\JDeveloper\jdevhome\jdev\myclasses>javap -verbose oracle.apps.fnd.framework.test.webui.testEmpCO
 > CODetailed

which gave me following output (again pasting relevant sections for sake of brevity)


 433: invokeinterface #28, 2; //InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
 438: checkcast #29; //class String
 441: astore 10
 443: aconst_null
 444: aload 9
 446: if_acmpeq 461
 449: aload_0
 450: aload_1
 451: aload_3
 452: aload 9
 454: aload 10
 456: aload 5
 458: invokespecial #79; //Method _triggerProcess:(Loracle/apps/fnd/framework/webui/OAPageContext;Loracle/apps/fnd/framework/OAApplicationModule;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
  461: return
 Exception table:
    from    to    target    type
    223    324    327    Class oracle/apps/fnd/framework/OAException

LineNumberTable: line 138: 0 line 140: 8 line 141: 14 line 142: 26 line 144: 34 line 145: 42 line 147: 52 line 148: 58 line 149: 73 line 150: 88 line 152: 107 line 153: 122 line 155: 133 line 156: 152 line 157: 171 line 158: 187 line 159: 206 line 161: 212 line 167: 223 line 168: 245 line 170: 254 line 171: 259 line 173: 274 line 175: 286 line 177: 300 line 178: 305 line 180: 316 line 185: 327 line 187: 329 line 188: 337 line 190: 346 line 191: 362 line 192: 375 line 193: 383 line 194: 391 line 196: 397 line 200: 411 line 201: 427 line 202: 443 line 203: 449 line 213: 461

I tried to compare the verbose output of both. Though I couldn’t make much out of it, I noticed one thing: for correct class (testEmpCO), the last line number in line number table (line 213: 461) against the last assembly instruction was same as the last line number of the disassembled code.(461: return)

However, for the class which had the error (UploadAMImpl), the last line in the line number table was 194 (line 173: 194). However the last line number for disassembled code was 193 (193: areturn). I became curious and checked the last assembly instruction which was starting at line 173 (pasted again below):


 170: invokestatic #92; //Method oracle/apps/fnd/framework/OAException.wrapperException:(Ljava/lang/Exception;)Loracle/apps/fnd/framework/OAException;
 173: athrow

Though I couldn’t decipher it completely, I could make out from instructions that it was something related to OAWrapperException, which was present in my code.

I decided to replace the same with OAException which is the normally followed practice instead of OAWrapperException, which I had copied from Fwk developer’s guide. After doing the change, I ran again


D:\JDeveloper\jdevhome\jdev\myclasses>javap -verbose oracle.apps.fnd.framework.test.UploadAMImpl >
AMDetailed.server

and the following was the output:


 195: invokespecial #32; //Method oracle/apps/fnd/framework/OAException."":(Ljava/lang/String;B)V
 198: athrow
 199: return
 Exception table:
    from    to    target    type
	   13    178    181    Class java/lang/Exception

LineNumberTable: line 106: 0 line 107: 8 line 109: 13 line 110: 20 line 112: 27 line 113: 43 line 114: 59 line 115: 74 line 116: 85 line 117: 104 line 118: 114 line 119: 130 line 120: 146 line 121: 162 line 123: 181 line 124: 182 line 125: 186 line 127: 199

Now, last line number in line number table 199 (line 127: 199) was matching with last line number of disassembled code ( 199: return). I hoped by now that this should work and after deploying, it really worked !!!!

I don’t know what was causing OAWrapperException to cause this issue , but I thought I would share this technique as this is generic error and it can be encountered by any java programmer. This is rare error and that is why it is difficult to address, as not lot of practical help is available on this and programmers can learn to unleash the power of javap and its various options.

I hope the technique I’ve described above will be handy for programmers who come across this kind of error.

Our guest writer, Vishal Chougule, is an avid Java developer and a technology lover. His interests range from computer security to design patterns.

Categories
Uncategorized

A Quick Tutorial to Set Up an NFS Server on Windows

Update (Nov 9, 2011): As noted in the comments below, Windows Services for UNIX Version (SFU) is no longer supported on Windows 7 and 2008. For these versions, try installing Cygwin with the optional nfs-server component. If you’re using Windows 2008, you can use the Server for NFS that comes built-in instead – in this case, most of the steps below should apply.

A few days ago, I needed to share a large folder present on a Windows server to access it from my local Ubuntu workstation. I initially used Samba, but my build script refused to recognize paths present in that share.

The solution was to use an NFS share – but this required a special setup on Windows. Even after a lot of searching on Google, I couldn’t easily find a guide that talked about how to get started with an NFS server on Windows quickly. Most articles I came across were only detailing information on NFS security, or some obscure command line options for tweaking NFS options – which shouldn’t be required when all you want is a simple share within your local, protected network.

So, here’s what to need to do if you need an NFS server enabled on Windows quickly, and mount it on your Linux box:

1) Download Windows Services for UNIX from Microsoft’s Download Center. Here’s the direct download link.

2) Run setup.exe from the extracted directory.

Welcome to the Microsoft Windows Services for UNIX Setup Wizard

3) Follow the prompts, until you reach the following screen:

Installation Options

Choose custom installation – since we’d like to only install the NFS server for sharing folders.

4) Choose the following three components to install:
(i) NFS -> Server for NFS
(ii) Authentication tools for NFS -> User Name Mapping
(iii) Authentication tools for NFS -> Server for NFS Authentication

Here’s a pictorial representation of the components you’ll need:

Selecting Components   Selecting Components

5) On the next screen, choose to change the behavior to case-sensitive, to provide full compatibility with UNIX programs

6) On the User Name Mapping screen, choose “Local User Name Mapping Server” and “Password and group files”:

User Name Mapping

7) Now, copy your passwd and group files from your UNIX/Linux distribution onto your Windows machine. For Ubuntu, these are located at /etc/passwd and /etc/group. Provide the paths to these files in the next screen:

User Name Mapping Configuration

8) Continue with the installation prompts until you finish.

Installation...

9) Windows Services for UNIX should now be installed:

Windows -> All Programs

10) Open the Services for UNIX Administration shortcut, and click on User Name Mapping:

User Name Mapping on local computer

11) Click on “Show User Maps” and then click on the buttons for Listing Windows Users and Linux Users:

Creating a map

12) Choose “Administrator” (or the appropriate account you want to map the UNIX user to) in the Windows list, and your username in the Linux list. (In Ubuntu, UIDs for user accounts usually start from 1000)

13) Click “Add” to create a map. If you get the following warning, click “OK” to ignore it.

You have specified a special Windows account.

14) Click Apply at the top right corner.

15) Now, you’re ready to share folders! Just right click any folder you need to share, and share it from the NFS tab. You can click the Permissions button for more options, like allowing write access, which is disallowed by default.

NFS Sharing on Windows.

16) Next, mount the share on your UNIX/Linux machine. I used the following command on Ubuntu:

$ sudo mount <windows-server-ip-address>:/<windows_share_name> <path_to_local_mount_point>

For example:

$ sudo mount 192.168.1.3:/SharedFolder ~/windows_share

If this guide helped you, please let us know in the comments below!