Stumped with the nag for long when I was compiling OpenMotif
[root@cslab206 openmotif-2.3.3]# locate "X11/bitmaps"
/usr/include/X11/bitmaps
/usr/include/X11/bitmaps/xm_error
/usr/include/X11/bitmaps/xm_hour16
/usr/include/X11/bitmaps/xm_hour16m
/usr/include/X11/bitmaps/xm_hour32
/usr/include/X11/bitmaps/xm_hour32m
/usr/include/X11/bitmaps/xm_information
/usr/include/X11/bitmaps/xm_noenter16
/usr/include/X11/bitmaps/xm_noenter16m
/usr/include/X11/bitmaps/xm_noenter32
/usr/include/X11/bitmaps/xm_noenter32m
/usr/include/X11/bitmaps/xm_question
/usr/include/X11/bitmaps/xm_warning
/usr/include/X11/bitmaps/xm_working
or directly looking into /usr/include/X11/bitmaps, actually the "gray" lost there.
Then, google around and got tips from some guys who cued that I should follow by
" yum -y install xbase"
Still no joy.
Try searching in the yumdb:
[root@cslab206 openmotif-2.3.3]# yum list "*bitmap*"
Loaded plugins: presto, refresh-packagekit
Installed Packages
bitmap-fonts.noarch 0.3-9.fc12 @anaconda-InstallationRepo-200911081904.x86_64
wqy-bitmap-fonts.noarch 0.9.9-11.fc12 @fedora
Available Packages
bitmap.x86_64 1.0.3-6.fc12 fedora
bitmap-cjk-fonts.noarch 0.3-9.fc12 fedora
bitmap-fonts-common.noarch 0.3-9.fc12 fedora xorg-x11-xbitmaps.x86_64 1.0.1-9.fc12 @fedora
japanese-bitmap-fonts.noarch 0.20080710-8.fc12 fedora
mona-bitmap-fonts.noarch 2.90-9.fc12 fedora
nethack-bitmap-fonts.noarch 3.4.3-23.fc12 fedora
nethack-bitmap-fonts-core.noarch 3.4.3-23.fc12 fedora
wqy-bitmap-fonts.noarch 1.0.0-0.1.rc1.fc12 updates
yum -y install xorg-x11-xbitmaps
back to openmotif,
make, make install, works well!
Tuesday, December 21, 2010
Monday, December 20, 2010
Integral transform
Mathematical notation aside, the motivation behind integral transforms is easy to understand. There are many classes of problems that are difficult to solve—or at least quite unwieldy algebraically—in their original representations. An integral transform "maps" an equation from its original "domain" into another domain. Manipulating and solving the equation in the target domain can be much easier than manipulation and solution in the original domain. The solution is then mapped back to the original domain with the inverse of the integral transform.
Sunday, December 19, 2010
Running an existing OS in VirtualBox under Fedora Linux
(Copied precisely from http://blog.amhill.net/2010/01/27/linux-ftw-using-virtualbox-with-an-existing-windows-partition/ )
If you’re clever, you can load their PPA into your software sources list (System->Admin->Software Sources), load the key, and that way you’ll get updates automatically! (plus you can apt-get install it )
Either way — install the most recent version of the personal edition (NOT “OSE”, which is the open-source version.) As of this post, the current version for Karmic (64-bit) is VirtualBox 3.1.2.
Your system will NOT be affected by this — all it does is copy the MBR from your computer, dump it into a file and that’s it.
NOTE: Originally, I had used the full name flag (–force) which uses two dashes. Due to the way my stylesheet renders italicized fonts, it looked like it was a single dash, understandably confusing some people. If you are getting the error message:
It’s worth noting that if you are currently mounting your windows partition in Linux (I do) so that you can access your Windows filesystem while in Linux, you will need to unmount (eg. sudo umount /windows) it first.
You’ll want to determine which partition contains Windows, so we can restrict Windows to ONLY using its own partition — this is actually a Linux-exclusive ability (the Windows version of Vbox can’t do this, because Windows is a wuss). So to do this, first you need to know what partition(s) Windows is on. This command will tell you:
The command will produce output that looks something like this:
The last line is the one you want to look for, although yours may not be your last line. Whichever one(s) have 0×07 as their “Type” are the one(s) you want. Jot down the number(s) for those. (In this case, my number is just “4″).
Now there’s one last thing we have to do that may make you a little uncomfortable, if you’re a paranoid person. We need to change the permissions on the hard drive device nodes. If you don’t know what that means, then you are probably not paranoid about that.
Fortunately, we only need to change the permissions slightly, and only on the Windows partitions. So it’s not THAT big of a deal.
In a terminal, type:
For those of you that are paranoid: You should be able to change the permissions back to 600 after we’ve created the VDMK file — VirtualBox needs access to your partition table so it can do its job.
There’s one last thing we need to do, and that’s adding you to the “disk” group, so you can access the partitions you just opened up. You’ll need to logout and log back in after doing this, so that your permissions are reset. (Previously forgot to include the username — thanks Ken!)
The number next to the partitions is the numbers you jotted down from the previous “listpartitions” command (the one where I said I felt naked). If you are using more than one partition, you will need to list them as comma-separated values. So if you wanted partitions 1 and 2 for Windows, you would replace the “4″ I wrote there with “1,2″. Partitions 2, 3 and 4 would be “2,3,4″ and so on.
The “partitions” parameter is what tells VirtualBox “only give Windows access to these partitions, and no where else!”
Just to break down what’s going on here:
VBoxManage internalcommands createrawvmdk – this portion runs the program to “Create Raw VMDK”. Self-explanatory. DO NOT USE SUDO HERE (h/t to Javier, below!)
-filename ~/.VirtualBox/winxp.vmdk – this is the output file that actually holds the micro-image. You can call it whatever you like, and you can put it whereever you like. If you have multiple Virtual Machines, you may like to file them away in a separate folder. Whatever you like.
-rawdisk /dev/sda -partitions 4 -This tells it that the raw Windows installation is located on device /dev/sda and that you only want to use partition 4 (yours may be different, as noted above)
-mbr ~/.VirtualBox/FAKE.mbr -relative – the -mbr parameter tells it to use that Fake MBR we created earlier. It won’t work without this. -relative is a parameter that works in conjunction with the -partitions parameter, to allow you to explicitly specify which partition you want to use.
-register – This tells VirtualBox to register it in its database of available images. Not absolutely necessary, but it’s a nice shortcut.
That’s it. Chances are, if you are going to get errors anywhere, it’s likely to be here.
Possible causes, based on my experience and what I’ve read about on the Internet, is that you didn’t set permissions correctly, didn’t unmount your device, are using the Open-source edition (which doesn’t have createrawvdmk) instead of the closed-source personal edition. If you get an error, you can post it in a comment and I’ll see if I can help you, but google around — there are a LOT of resources online for this. Below, I’ll include links to the places I looked.
In VirtualBox, click on “New”, and follow the instructions for the first couple of screens. Name it whatever you like and select your OS (these instructions have all applied to Windows XP so far — caveat operor on any other versions / OSs). Once you get to the “Virtual Hard Disk” screen (pictured here) select “Use existing hard disk” and you should see the VDMK file we just created. If you don’t, click the little folder icon next to the drop down list. It will allow you to “add” your vdmk file that you created.
Once that’s done, you’ll be back at the main screen.
Click once on your new Virtual Machine, and click the “Settings” icon at the top. You need to do a few more things first.
In the Acceleration tab — some CPUs have the native instructions built for virtualization — modern Intel CPUs do. If you paid a little extra for your CPU and you bought it in the past year or two, you might have these. I forget the specific models that have it, but it’s something that’s easy to overlook.
Under “Display” area, adjust the slider to specify how much Video RAM you want to give your VM. I picked “64MB” for mine… very modest. You can also check “Enable 2d Acceleration” and “Enable 3d acceleration” simply because it won’t hurt to do so… but again, if you’re doing things that require hardware acceleration, a VM probably isn’t the best way to do it.
That’s it — the rest of the stuff is just icing. You can tinker with it if you want, but you’re good to go.
Click on “OK” to get out of there, then click “Start” (green arrow at the top). The first time you boot up, it may take a little while longer than usual.
This is the other point that is prone to errors. The first time I did this, I had errors because I didn’t do the -partitions parameter in my VDMK creation, which gave me “disk read” errors. You might get a blue screen of death or some other nonsense. If you get any errors — google it. Like I said earlier, there’s lots of support for it.
Windows will go through some growing pains this first boot sequence, as it maps all the hardware drivers to the VirtualBox extensions provided — You will likely need to restart. No guarantees on all the hardware working as it does in a native boot. You should be able to use things like Word, browse the web, use Photoshop (if you allocated enough RAM…you can always change that later), etc. Anything relatively lightweight should be fine.
I am pretty sure that if you alternately boot raw and boot virtual, you will have to do this rescue disk procedure each time. Be careful with doing a repair on a raw boot, though, if you use Grub. Currently, I do not know of any way to use the partition for both Windows 7 raw and virtual boots without using the rescue disc fix.
Install Virtual Box
Ok, for starters, you need the CLOSED SOURCE version of VirtualBox. As in — do not install the one from the Ubuntu Software Center. Go directly to Sun’s website and download the appropriate version for your OS.If you’re clever, you can load their PPA into your software sources list (System->Admin->Software Sources), load the key, and that way you’ll get updates automatically! (plus you can apt-get install it )
Either way — install the most recent version of the personal edition (NOT “OSE”, which is the open-source version.) As of this post, the current version for Karmic (64-bit) is VirtualBox 3.1.2.
Install “mbr”
In order to successfully trick Windows into booting into a confined space, you need to fake your mbr (no grub). Fortunately this is WAY easier than it sounds:sudo apt-get install mbrThat’s it! We’ll use that later.
install-mbr –f ~/.VirtualBox/FAKE.mbr
Your system will NOT be affected by this — all it does is copy the MBR from your computer, dump it into a file and that’s it.
NOTE: Originally, I had used the full name flag (–force) which uses two dashes. Due to the way my stylesheet renders italicized fonts, it looked like it was a single dash, understandably confusing some people. If you are getting the error message:
install-mbr: Offset must be a number: rceThen either use just -f instead, or ensure that you are using two -’s before “force”.
Create a VDMK file
This is actually the trickiest part. A VDMK, which I am not sure what that is an acronym for, is essentially a micro-image that contains instructions to tell MBR where it’s booting from. If your computer is modern, your hard drives are likely SATA drives (and thus represented as /dev/sda). If you’re unsure, just go into a shell and type “fdisk -l” (no quotes, and that last part is a “dash lowercase-L” not “dash one”). What you want is the device name for your harddrive… mine is /dev/sda — depending on how many hard drives you have and what type they are, it might be /dev/hda/ or /dev/sdb/ etc.It’s worth noting that if you are currently mounting your windows partition in Linux (I do) so that you can access your Windows filesystem while in Linux, you will need to unmount (eg. sudo umount /windows) it first.
You’ll want to determine which partition contains Windows, so we can restrict Windows to ONLY using its own partition — this is actually a Linux-exclusive ability (the Windows version of Vbox can’t do this, because Windows is a wuss). So to do this, first you need to know what partition(s) Windows is on. This command will tell you:
VBoxManage internalcommands listpartitions -rawdisk /dev/sdaFor the boldfaced part, use whatever you determined from above. It’s PROBABLY /dev/sda for you too, that’s pretty common.
The command will produce output that looks something like this:
VirtualBox Command Line Management Interface Version 3.1.2I have to admit, I feel a little naked showing the whole Internet my partition table…
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0×83 0 /1 /1 1023/254/63 53348 63
2 0×82 1023/254/63 1023/254/63 4000 109258065
3 0×83 1023/254/63 1023/254/63 155998 117451215
4 0×07 1023/0 /1 1023/254/63 91895 436935870
The last line is the one you want to look for, although yours may not be your last line. Whichever one(s) have 0×07 as their “Type” are the one(s) you want. Jot down the number(s) for those. (In this case, my number is just “4″).
Now there’s one last thing we have to do that may make you a little uncomfortable, if you’re a paranoid person. We need to change the permissions on the hard drive device nodes. If you don’t know what that means, then you are probably not paranoid about that.
Fortunately, we only need to change the permissions slightly, and only on the Windows partitions. So it’s not THAT big of a deal.
In a terminal, type:
sudo chmod 666 /dev/sdaThat second line should reflect whichever hard drives you are using (remember that fdisk -l we did?) You’ll need to repeat the command for each hard drive that you want Windows to be able to access.
sudo chmod 660 /dev/sda4
For those of you that are paranoid: You should be able to change the permissions back to 600 after we’ve created the VDMK file — VirtualBox needs access to your partition table so it can do its job.
There’s one last thing we need to do, and that’s adding you to the “disk” group, so you can access the partitions you just opened up. You’ll need to logout and log back in after doing this, so that your permissions are reset. (Previously forgot to include the username — thanks Ken!)
sudo usermod -a -G disk yourusernameOk, now you’re ready to actually create the VDMK file. Get ready because this is a handful.
VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/winxp.vmdk -rawdisk /dev/sda -partitions 4 -mbr ~/.VirtualBox/FAKE.mbr -relative -registerFirst off — the “sda” is whatever you determined you’re using, from earlier. It’s probably “sda”, like I mentioned earlier.
The number next to the partitions is the numbers you jotted down from the previous “listpartitions” command (the one where I said I felt naked). If you are using more than one partition, you will need to list them as comma-separated values. So if you wanted partitions 1 and 2 for Windows, you would replace the “4″ I wrote there with “1,2″. Partitions 2, 3 and 4 would be “2,3,4″ and so on.
The “partitions” parameter is what tells VirtualBox “only give Windows access to these partitions, and no where else!”
Just to break down what’s going on here:
VBoxManage internalcommands createrawvmdk – this portion runs the program to “Create Raw VMDK”. Self-explanatory. DO NOT USE SUDO HERE (h/t to Javier, below!)
-filename ~/.VirtualBox/winxp.vmdk – this is the output file that actually holds the micro-image. You can call it whatever you like, and you can put it whereever you like. If you have multiple Virtual Machines, you may like to file them away in a separate folder. Whatever you like.
-rawdisk /dev/sda -partitions 4 -This tells it that the raw Windows installation is located on device /dev/sda and that you only want to use partition 4 (yours may be different, as noted above)
-mbr ~/.VirtualBox/FAKE.mbr -relative – the -mbr parameter tells it to use that Fake MBR we created earlier. It won’t work without this. -relative is a parameter that works in conjunction with the -partitions parameter, to allow you to explicitly specify which partition you want to use.
-register – This tells VirtualBox to register it in its database of available images. Not absolutely necessary, but it’s a nice shortcut.
That’s it. Chances are, if you are going to get errors anywhere, it’s likely to be here.
Possible causes, based on my experience and what I’ve read about on the Internet, is that you didn’t set permissions correctly, didn’t unmount your device, are using the Open-source edition (which doesn’t have createrawvdmk) instead of the closed-source personal edition. If you get an error, you can post it in a comment and I’ll see if I can help you, but google around — there are a LOT of resources online for this. Below, I’ll include links to the places I looked.
Load your new VDMK into Virtual Box
Load up Virtualbox, if you installed it through the automated installation (rather than compiling it manually), you should see it in Applications -> System Tools -> Sun Virtual Box. If you don’t see it there, try logging out and logging back in.In VirtualBox, click on “New”, and follow the instructions for the first couple of screens. Name it whatever you like and select your OS (these instructions have all applied to Windows XP so far — caveat operor on any other versions / OSs). Once you get to the “Virtual Hard Disk” screen (pictured here) select “Use existing hard disk” and you should see the VDMK file we just created. If you don’t, click the little folder icon next to the drop down list. It will allow you to “add” your vdmk file that you created.
Once that’s done, you’ll be back at the main screen.
Click once on your new Virtual Machine, and click the “Settings” icon at the top. You need to do a few more things first.
Configuring your Virtual Machine
In the “System” area, be sure to check “Enable IO APIC” in the “Motherboard” tab. In “Processor”, specify how many CPUs you want to use (ie. I have a Core 2 Duo, so I can choose more than one). You really only need 1 — if you’re doing stuff that requires more, you should probably boot into Windows natively.In the Acceleration tab — some CPUs have the native instructions built for virtualization — modern Intel CPUs do. If you paid a little extra for your CPU and you bought it in the past year or two, you might have these. I forget the specific models that have it, but it’s something that’s easy to overlook.
Under “Display” area, adjust the slider to specify how much Video RAM you want to give your VM. I picked “64MB” for mine… very modest. You can also check “Enable 2d Acceleration” and “Enable 3d acceleration” simply because it won’t hurt to do so… but again, if you’re doing things that require hardware acceleration, a VM probably isn’t the best way to do it.
That’s it — the rest of the stuff is just icing. You can tinker with it if you want, but you’re good to go.
Click on “OK” to get out of there, then click “Start” (green arrow at the top). The first time you boot up, it may take a little while longer than usual.
This is the other point that is prone to errors. The first time I did this, I had errors because I didn’t do the -partitions parameter in my VDMK creation, which gave me “disk read” errors. You might get a blue screen of death or some other nonsense. If you get any errors — google it. Like I said earlier, there’s lots of support for it.
Once You’re In Windows
Some of the sites I’ve read have suggested creating an alternate hardware profile for when you boot into Vbox. This is a good idea if you plan on booting into it normally once in a while (for games or whatnot). To create a new Hardware Profile, right click on “My Computer” and click “Properties”. Select “Hardware” then at the bottom, select “Hardware Profiles”. Create a new one and name it “Raw Boot”, and rename the current one to “VBox Boot”.Windows will go through some growing pains this first boot sequence, as it maps all the hardware drivers to the VirtualBox extensions provided — You will likely need to restart. No guarantees on all the hardware working as it does in a native boot. You should be able to use things like Word, browse the web, use Photoshop (if you allocated enough RAM…you can always change that later), etc. Anything relatively lightweight should be fine.
Working with Windows 7 (Update!)
One of the commenters below, Sandeep (“Sandy”), has figured out how to get a Windows 7 partition to work with this method. There are a couple small steps that need to be done, and he was cool enough to take screen shots for this blog:- Before you begin, be sure your VDMK is configured, per the instructions above [screenshot]. You will also need to have the Windows 7 Rescue ISO loaded, which can be done within the VirtualBox configuration (before starting a VM instance)
- Once that’s ready, boot up the Windows 7 VM [screenshot] Sandeep is using a newer version of VirtualBox, apparently, but AFAIK, it should still work even if yours says “Sun” instead of “Oracle”
- When prompted, boot to the rescue CD by pressing the appropriate key. [screenshot]
- At the menu, select “Repair Installation” [screenshot]
- Select “Repair & Restart” [screenshot]
I am pretty sure that if you alternately boot raw and boot virtual, you will have to do this rescue disk procedure each time. Be careful with doing a repair on a raw boot, though, if you use Grub. Currently, I do not know of any way to use the partition for both Windows 7 raw and virtual boots without using the rescue disc fix.
Congratulations!
That’s it! Tinkering and optimizing aside, you’re done.Further Reading
I would not have been able to do this without help from many other bloggers and hackers out there. Here are some of the resources I used to get this working:- Trouble running VirtualBox with “real” partition (UbuntuForums)
- The VirtualBox user manual (search for “vdmk”)
- VirtualBox: How to boot from an existing Windows XP partition in Ubuntu
- How to Run Virtual Box using a Physical Partition in Feisty Fawn (an older distro, but the methods haven’t changed THAT much)
- Accessing RAW Partitions with VDMK (VirtualBox forums)
Easy way to backup/copy MBR under linux
1. get to know where the current MBR lies
sudo /sbin/fdisk -l
the line tagged with an asterisk in between (aligned with column "Boot" ) indicates what you want.
2. read out and write into wherever you desire using dd
dd if=/dev/sda4 bs=512 count=1 of=/root/mbr.FAKE
Saturday, December 11, 2010
Q&A for Oracle Distributed Database Application Development Environment Setting
1. Driver installation – oracle JDBC
Like the installation of JDBC driver for MySql, installing the JDBC driver for oracle also needs to follow the same RULE OF THUMB:
- Extract the compressed archive downloaded (ojdbc6dms_g.jar or ojdbc6dms.jar, for example) and fetch out only the .jar file, and put it into the $JAVA_HOME/jre/lib/ext directory!! NOT $JAVA_HOME or the so-called CLASSPATH which is ordinary $JAVA_HOME/jre/lib !!
- And, for safety you should make the permission 644 for the library (.jar) under this directory.
2. SQL Developer Installation and Connection
After Installing SQLDeveloper (linux X86_64), you may want to use it immediately starting from connecting a DB.
While trying with this following problems might be waiting for you:
a. Firstly you will most possibly come across this DMS gnat:
oracle.classloader.util.AnnotatedNoClassDefFoundError:
Missing class: oracle.dms.console.DMSConsole
Dependent class: oracle.jdbc.driver.DMSFactory
Loader: jre.extension:0.0.0
Code-Source: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/ext/ojdbc6dms_g.jar
Configuration: system property java.ext.dirs
this is caused by lack of an essential library, It is DMS!
To fix it, you need to install this library. I just copy dms.jar under the installation directory for
JDeveloper into $CLASSPATH/ext to resolve this gnawing problem!
b. after fixing up problem a, another one is there greeting you:
oracle.classloader.util.AnnotatedNoClassDefFoundError:
Missing class: oracle.core.ojdl.MessageType
Dependent class: oracle.dms.instrument.Level
Loader: jre.extension:0.0.0
Code-Source: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/ext/dms.jar
Configuration: system property java.ext.dirs
This is another "library shortage" problem - lacking ojdl.jar. It is not really the empytiness you might found with the "core package" in the dms.jar that is the culprit, but the ojdl.jar, completely yet another libraries!
To make up this library, I simply drag it from still the JDeveloper installation directory into $CLASSPATH/ext to make the SQLDeveloper docile!
Now, the connection should be ok!
3. Generate tables and feed random data into the database
Here we make use of BenchMark-SQL-2.3.2 to do this.
However, you ought to find that this tools is not so friendly as you might expect under linux environments. So here goes problems and solutions to those problems as follows:
a. when you firstly try running the script runSQL.sh, you probably get stunned immediately by this error : err.sh: line 1: /bin/java: No such file or directory.
This is occuring just because $JAVA_HOME does not effect at all. To fix this, follow these two simple steps:
1> head lines as follows in runSQL.sh
#!/bin/bash
source ~/.bash_profile
2> convert the script, which is most likely in a DOS format while downloaded, to unix format by dos2unix
b. You might hit the wall on this error : No suitable driver found!
This is most likely due to incorrect setting for connection in the properties file that the main runSQL.sh script uses. Here is the hopeful solution:
edit the .properties file. Now since we use oracle driver and database, we had better to use oracle.properties under the "run" subdirectory.
Then change things like this:
driver=oracle.jdbc.driver.OracleDriver
#conn=jdbc:oracle:thin:@localhost:1521:XE
#user=scott
#password=tiger
conn=jdbc:oracle:thin:@dia2.cs.usm.edu:1521:dia2
user=xxxxxx
password=*************
note that the value for "conn" is not simply the host name, you should comply with the format above, including driver type, host, port and SID.
c. Following the same solution above to beat the same problems you might be confronted with loadData.sh.
Now, you should get all data randomly inserted into the database.
4. Get hands on SQLJ
Not exaggerating, doing with SQLJ is far more arduous than with JDBC, at least in the context of Oracle Database Application Development according to my real practice.Let me show as follows selected problems you might encounter and my solutions to them at the cost of large amount of time with the Google search and reading through oracle discussion forums..
4.1 SQLJ driver installation
Actually in terms of database connection, SQLJ is not really a driver in the sense of what we refers to JDBC drivers, it is a java compiler accessory, to my knowledge and understanding towards this stuff, that is used to interpret SQLJ based code in the java program by SQLJ translator.So in order the java application to employ SQLJ, both JDBC driver and SQLJ translator must be prepared in the development environment.
a. oracle JDBC driver for SQLJ translator
For what is mentioned above, we should make sure that JDBC driver works well with SQLJ. A simplest test could be done with the attachment test programs in the SQLJ download, found in the demo directory.
Just “javac TestInstallJDBC.java” and then “java TestInstallJDBC”, things happen out of our expectation however. JVM complains with following gnats:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jdk1.6.0_22/jre/lib/oci_solaris/libocijdbc11.so: /usr/java/jdk1.6.0_22/jre/lib/oci_solaris/libocijdbc11.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1803)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1728)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
However, the download page only provides the 32bit library!
After fiddling on Google with queries containing “Oracle xxxx” and lot of time burned, I find a very devious way out at last – installing Oracle InstantClient and then fetching libraries bounded inside, which include what we need as above.
Download and install the Oracle InstantClient basics for 64bit architecture (oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm, for instance), and find the libraries missed in the directory “/usr/lib/oracle/11.2/client64/lib/” , copy following libraries into the $CLASSPATH/oci_drivers to replace the those 32bit versions :
libclntsh.so.11.1 libheteroxa11.so libnnz11.so libocci.so.11.1 libociei.so libocijdbc11.so
reexport LD_LIBRARY_PATH so that to make it effect, then just change things related to actual/existent table name in the TestInstallJDBC.java, recompile and run, you can get it work!
b. Install SQLJ translator
runtime11.jar runtime12ee.jar runtime12.jar runtime.jar runtime-nonoracle.jar translator.jar
among which translator.jar and one of the runtime*.jar are definitively necessary, just copy them to the $CLASSPATH/ext directory. ALSO, these two jars should be included in the CLASSPATH itself!
However, when you directly launch the sqlj executable in the bin directory for testing or verification of the well preparedness of SQLJ, it complains after dumping help message like:
Error: This JDBC library requires JDK 1.4. Your are using JDBC library ojdbc14.jar under JDK 1.3 or earlier. Either run in a JDK 1.4 environment, or use the JDBC library classes111.jar or classes12.jar.
Warning: Code generator "oracle" cannot be instantiated from class oracle.sqlj.codegen.CodeGenFactory: oracle/xdb/XMLType.
Total 1 warning.
Probing for a while with SQLJ documentation online, it might stuck us to change to other way to run it:
./sqlj -codegen=oracle
Unfortunately, the stack dumps the loathsome as follows:
unexpected error occurred...
java.lang.NoClassDefFoundError: oracle/xdb/XMLType
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at sqlj.framework.JSClass$ClassWrapper.getDeclaredMethods(JSClass.java:1809)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1639)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1649)
Following the same cracking idea, we continue to find the missed things.
Firstly, the xdb library, we can find it through “www.findjar.com” and wget it from “http://mirrors.ibiblio.org/pub/mirrors/maven/mule/dependencies/maven1/oracle-xdb/jars/xdb.jar". Also place it under $CLASSPATH/ext. Then error seems endless:
So it is not the real treatment by making up each single library one by one!
Since it appears that we need the XML holistic library or something as a whole actually, we simple go Oracle site and find it. Yes it is "xdk_linux_10_1_0_2_0_production". Download it and unpack the jar, and for safety just copy all the .jar under the lib dictory to $CLASSPATH/ext, including:
xdb.jar xmlcomp2.jar xmlcomp.jar xmldemo.jar xml.jar xmlmesg.jar xmlparserv2.jar xschema.jar xsqlserializers.jar xsu12_817.jar xsu12.jar classgen.jar
Take another try, we are still not that lucky:
unexpected error occurred...
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at sqlj.framework.JSClass$ClassWrapper.getDeclaredMethods(JSClass.java:1809)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1639)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1675)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1681)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1638)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1665)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1670)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1639)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1649)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1664)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1670)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1639)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1675)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1681)
at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1638)
Keep on! Find servlet at Oracle site and manually pack it into a single jar file, named as servlet.jar for instance, and place it under $CLASSPATH/ext.
Now JVM finally stops complaining with runtime errors like the foregoing gnats!
Until this point, your SQLJ should work fine, which could be verified by running test code bundled with the SQLJ translator downloads that lies in the demo directory.
Now enter the demo
- javac TestInstallCreateTable.java
- java TestInstallCreateTable
// now Example table SALES should be created correctly
- sqlj TestInstallSQLJ.sqlj
- java TestInstallSQLJ
And "Hello, SQLJ!" should be seen in the output then.
Supplementary Notes ( for the pitiful )
However, SQLJ does not get all right even now, I just still faced this prompt at the end of the output with "sqlj -codegen=oracle":
Error: This JDBC library requires JDK 1.4. Your are using JDBC library ojdbc14.jar under JDK 1.3 or earlier. Either run in a JDK 1.4 environment, or use the JDBC library classes111.jar or classes12.jar.
I have tried many times of reinstalling higher version of JDK (1.6.0_22), but it does not cure this problem in the end!
FINALLY, we found the problem consists in the JDBC driver – the version we use is not consistent with the JDK version and OCI driver libraries!
WAY OUT: With JDK 1.3 or lower, and ocijdbc11 (i.e. libclntsh.so.11.1 libheteroxa11.so libnnz11.so libocci.so.11.1 libociei.so libocijdbc11.so), we should use JDBC at version 5! which can be found in InstantClient package, under the lib directory. Place the ojdbc5.jar in the $CLASSPATH/ext and remove the higher version, ojdbc6dms.jar, say.
Now, SQLJ should be definitely working there well!
Tuesday, November 23, 2010
The Art of Unix Programming
The Art of Unix Programming
Also including C programming traps and pitfalls into the "To Read List"
Saturday, November 20, 2010
Notes to the Final Project for CSC733 Advanced Distributed Database
1. Driver installation
Like the installation of JDBC driver for mysql, installing the JDBC driver for oracle alse needs to follow the same RULE OF THUMB:
extract the compressed archive downloaded and fetch out only the .jar file, and put it into the $JAVA_HOME/jre/lib/ext directory!! NOT $JAVA_HOME or the
so-called CLASSPATH which is ordinary $JAVA_HOME/jre/lib !!
and for satety you should make the permission 644 for the library (.jar) under this directory.
2. SQL Developer Installation and Connection
After Installing SQLDeveloper(linux X86_64), you may want to use it immediately starting from connecting a DB.
While trying with this following problems might be waiting for you:
a. Firstly you will most possibly come across this DMS gnat:
oracle.classloader.util.AnnotatedNoClassDefFoundError:
Missing class: oracle.dms.console.DMSConsole
Dependent class: oracle.jdbc.driver.DMSFactory
Loader: jre.extension:0.0.0
Code-Source: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/ext/ojdbc6dms_g.jar
Configuration: system property java.ext.dirs
this is caused by lack of an essential library, It is DMS!
To fix it, you need to install this library. I just copy dms.jar under the installation directory for
JDeveloper into $CLASSPATH/ext to resolve this bitting problem!
b. after fixing up problem a, another one is there greeting you:
oracle.classloader.util.AnnotatedNoClassDefFoundError:
Missing class: oracle.core.ojdl.MessageType
Dependent class: oracle.dms.instrument.Level
Loader: jre.extension:0.0.0
Code-Source: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/ext/dms.jar
Configuration: system property java.ext.dirs
yes, this is another "library missing" problem - lacking ojdl.jar. It is not really the empytiness you might found with
the "core package" in the dms.jar that is the culprit, but the ojdl.jar, completely yet another libraries!
To make up this library, I simply drag it from still the JDeveloper installation directory into $CLASSPATH/ext to make this SQLDeveloper docile!
Now, the connection should be ok!
3. Generate tables and feed random data into the database
Here we make use of BenchMark-SQL-2.3.2 to do this.
However, you ought to find that this tools is not so friendly as you might expect under linux environments. So here goes problems and solutions to those problems as follows:
a. when you firstly try running the script runSQL.sh, you probably get stunned immediately by this error : err.sh: line 1: /bin/java: No such file or directory.
This is occuring just because $JAVA_HOME does not effect at all. To fix this, follow these two simple steps:
1> head lines as follows in runSQL.sh
#!/bin/bash
source ~/.bash_profile
2> convert the script, which is most likely in a DOS format while downloaded, to unix format by dos2unix
b. You might hit the wall on this error : No suitable driver found!
This is most likely due to incorrect setting for connection in the properties file that the main runSQL.sh script uses. Here is the hopeful solution:
edit the .properties file. Now since we use oracle driver and database, we had better to use oracle.properties under the "run" subdirectory.
Then change things like this:
driver=oracle.jdbc.driver.OracleDriver
#conn=jdbc:oracle:thin:@localhost:1521:XE
#user=scott
#password=tiger
conn=jdbc:oracle:thin:@dia2.cs.usm.edu:1521:dia2
user=xxxxxx
password=*************
note that the value for "conn" is not simply the host name, you should comply with the format above, including driver type, host, port and SID.
c. Following the same solutoion above to beat the same problems you might be confronted with loadData.sh.
Now, you should get all data randomly inserted into the database.
Subscribe to:
Posts (Atom)