Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Monday, October 25, 2010

Why can't I view JSPs on my Linux box?

This is a bit insane I must say. I have the following setup: Eclipse Helios, 64-bit JDK (1.6.0_21), Tomcat 6 (6.0.29), and a pretty straightforward JSP that does nothing other than evaluate the date.

I get this crap all the time:

javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/el/ELResolver
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:268)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
test.test01.MainServlet.goToPage(MainServlet.java:50)
test.test01.MainServlet.doGet(MainServlet.java:36)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause


java.lang.NoClassDefFoundError: javax/el/ELResolver
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
java.lang.ClassLoader.defineClass(ClassLoader.java:616)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
java.net.URLClassLoader.access$000(URLClassLoader.java:58)
java.net.URLClassLoader$1.run(URLClassLoader.java:197)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:190)
sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
java.lang.ClassLoader.loadClass(ClassLoader.java:307)
java.lang.ClassLoader.loadClass(ClassLoader.java:296)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
java.lang.ClassLoader.loadClass(ClassLoader.java:296)
java.lang.ClassLoader.loadClass(ClassLoader.java:248)
org.apache.jasper.runtime.JspFactoryImpl.getJspApplicationContext(JspFactoryImpl.java:209)
org.apache.jsp.WEB_002dINF.jsp.search_jsp._jspInit(search_jsp.java:22)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
test.test01.MainServlet.goToPage(MainServlet.java:50)
test.test01.MainServlet.doGet(MainServlet.java:36)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 I have checked everything I can think of (JAVA_HOME, CATALINA_HOME variables) and all check out okay. The project in eclipse is a dynamic web project and has all the $CATALINA_HOME/lib jar files in it including the el-api.jar file.

So what gives? The real annoying thing about this whole process is that I can export the war file, pop it onto my windows machine and it works just fine! I tried doing the same with Tomcat on Ubuntu and running it from there directly but am no better off. So, anyone know what the heck I am doing wrong?

Friday, February 12, 2010

Trying to use the Java plugin in Firefox

I've been trying forever to get the Java plugin to work on Firefox on Linux. There is an Ubuntu specific way to do it but I don't want to use apt to install it. My JDK is installed in /usr/local/jdk1.6.0_18.

So how do I do it? Used to be, you could go into the mozilla/plugins folder and you link the libjavaplugin_oji.so from the jre/plugins folder. Except no such file exists on my installation of the JDK. After searching on google and looking at official documentation from Oracle/Sun, I saw others have it... but not me. Turns out that my JDK is 64-bit and the setup is different. From one of the Oracle/Sun forums, I noticed that the name and path to the plugin are now different on the 64-bit version of the 1.6 JDK.

So, in my case, the plugin is located at
/usr/local/jdk1.6.0_18/jre/lib/amd64/libnpjp2.so
and by creating a symbolic link to it in ~/.mozilla/plugins, I have access to the Java plugin now. I needed that to use webex on my Ubuntu machine.

Tuesday, April 28, 2009

How do I set JAVA_HOME in Ubuntu so it works

I recently installed Ubuntu 9.04. And then I installed eclipse. I am trying to start it from an icon (yes, its via an icon... don't judge!) and am having an issue with setting the JAVA_HOME and PATH variables correctly.

When I kick off from a bash shell, the PATH is correct. But not from the panel in gnome. Of course, in the bash shell, I have both those variables set in ~/.bashrc. However, when I log in via the gdm, that file does not get read. I am trying to figure out what file gets read when I login so I can set the JAVA_HOME variable. I tried adding it to /etc/environment file, but I am at a loss as to how to add $JAVA_HOME/bin to the $PATH variable. For now, I start eclipse via the icon using

/usr/local/eclipse -vm /usr/local/jdk1.6.0_13/bin/java
and that works just fine for me...

Sunday, March 30, 2008

I win!

Damn you eclipse, you drove me nuts for a while. DAMN. I spent good chunks of my nights and weekends fighting you. I was about to give up and go back to Windows Vista. Damn. I need to update all my newly found Goran Bregović music anyway. Quite a few people mused about what it could be. They were right, somewhat. So, what was it in the end? Lets see.

I install ubuntu. I have no idea what version... The installer decided to install x86_64. Why? Well, I have a 64-bit compatible chip. Well, when you go to eclipse.org and download eclipse, they figure out somehow that I am running a 64-bit version of the OS and let me download the 64-bit version of eclipse. I didn't notice. I installed eclipse. All is good. Or so I thought. I try and fire it up. Nothing happens except for the error. You would think that something so large would log something somewhere. No such luck. I looked in the obvious place: ~/.eclipse. I ran eclipse -clean. No luck.

I searched google. Ubuntu docs say to use apt-get install eclipse. I tried that. No luck. And it installed all sorts of gcj nonsense that I don't really want. I want Sun JDK. More searching ensued. Hours went by. I watched Borat along the way. Its just as much fun the second time around (I watched it the first time on my second trip to Washington DC). Yet more searching. I checked all sorts of things. I tried to launch it manually. You know with all the 50 arguments it needs to start. Still no luck. And quite frustratingly, no log file that says 'Oh by the way, you need blah' or 'you are missing something X that I need in order to run properly'. Grrrrrr.

I ended up searching for stuff specific to Ubuntu and Eclipse and Linux and somehow I ended up on an eclipse.org page. They mention a log file in there too. I didn't find one anywhere. But it was at that point that I ran a uname -a. I had previously also tried to try and start eclipse using Java 1.5 (release 15) but still no luck. Well, uname -a told me I was running x86_64. I kept going. I downloaded the x64 version of Sun's JDK. Hmmm. I installed it. It wanted to overwrite stuff in the 32-bit JDK folder. I decided to wipe out all the 32-bit JDKs. I installed the 64-bit JDK. I ran ./eclipse once more. Would you believe it, I was asked to pick a workspace!

So much for all that checking. Silly me, I should have checked all that before I went about searching google. One issue I still have though is: if eclipse won't start, how the <deleted expletive> am I supposed to know that it is a 64-bit version of eclipse and requires a 64-bit JVM (or a modified start process with a -d32 flag or something)?

Oh well, so much for all that. I have eclipse running. Let that be a lesson to all of you. 64-bit computing is a pain in the ass.

Thursday, March 27, 2008

Getting Eclipse to work in Linux

Getting Eclipse to start in Linux is a nighmare. You can't just double click on stuff like in Windows. Right now, the error I get when I try and start eclipse, I get the error:


JVM terminated. Exit code=13
/usr/local/jdk1.6.0_05/bin/java
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-jar /usr/local/eclipse/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
-os linux
-ws gtk
-arch x86_64
-showsplash
-launcher /usr/local/eclipse/eclipse
-name Eclipse
--launcher.library /usr/local/eclipse/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.0.3.R33x_v20080118/eclipse_1023.so
-startup /usr/local/eclipse/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
-exitdata aa8030
-vm /usr/local/jdk1.6.0_05/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-jar /usr/local/eclipse/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
I launched the thing using
/usr/local/eclipse/eclipse -vm /usr/local/jdk1.6.0_05/bin/

Lets see how it goes... I am not giving up yet.

Monday, March 24, 2008

Sorry, I promise to do better

To my dear mentor and to my team mate... I do apologise for my lack of working. Its past 1am and I am up. But I assure you I have an ace up my sleeve now, I promise. What is it? Ubuntu 8. Installed via Wubi.

All I need to do now is apt-get install eclipse... okay, well maybe that was a dumb thing to say. I'll do in manually of course. But I assure you, now that I have a happy development environment without any crazy ass security (aside from selinux, but that's another story). I will be back soon, I promise. In the meantime, join the revolution, join Mao and step on the Tibetans... Not.

Nemo me impune lacessit as the good lads from the Black Watch would say. BTW, little known trivia fact; I do indeed own an 18 oz Black Watch kilt with highland hose and flashes... no sporran though. Yet.