MuleStudio – No option to Create New Mule Project

April 24th, 2012 § Leave a Comment

I installed MuleStudio community edition on Ubuntu 11.04. MuleStudio was starting but showed no option to create new Mule Project. Since I have multiple versions of JDK installed, so before starting mule studio I was explicitly exporting JAVA_HOME to point to JDK 1.6 in same terminal window from which muleStudio was being started. But it was not making any difference.

After long struggle I finally figured out that Mule was ignoring JAVA_HOME exported on command line. Instead it always went into .bashrc to pick JAVA_HOME defined there (which was pointing to JDK 1.5 in my case). Once I changed JAVA_HOME in .bashrc, everything stated working as expected.

Update on next day…..

I tested again by NOT SETTING JAVA_HOME correctly, but set PATH properly (to point to jdk 1.6 bin). MuleStudio works fine in this case. That means MuleStudio does not look at JAVA_HOME value (at least for starting-up correctly).

But I guess it should go through JAVA_HOME to find JDK executables (like $JAVA_HOME/bin/java instead of direct java or may be there’s a configurable file with Mule to define JAVA_HOME and PATH only for Mule, need to look more)

Tomcat – java.lang.UnsupportedClassVersionError: Bad version number in .class file

January 30th, 2012 § Leave a Comment

This is because your class files were compiled with a Java compiler not compatible with JVM in use within tomcat. If you compiled on same machine on which you have tomcat running, you must be having 2 JDKs (or a JDK and another JRE) with different versions. Solution to this is:

On Linux –

a) find tomcat bin folder and open catalina.sh in it (on my machine it is /usr/share/tomcat6/bin). You can also search for catalina.sh directly (find / -name catalina.sh).

b) Add correct JAVA_HOME to it and then restart tomcat (add it after all initial comments statements end)

export JAVA_HOME=/opt/java/jdk1.6.0_21/

On windows, you can make the same change in catalina.bat and it should work

Apache Config Steps – Run multiple domains on same ip

November 16th, 2011 § Leave a Comment

Suppose you want to point abc.mydomain.com and mydomain.com to same machine/ip, but to different applications. There are multiple ways to achieve this (basically with same config settings but in different files). I am giving one way here that worked for me:

* Go to /etc/apache2/sites-available
* open a file abc.mydomain.com.conf
* copy this to abc.mydomain.com.conf, make changes to folder path domain name etc. and Save the file


<VirtualHost *:80>

DocumentRoot /var/www/abcappfolder/
ServerAdmin admin@mydomain.com
ServerName abc.mydomain.com
ServerAlias www.abc.mydomain.com

Options FollowSymLinks
AllowOverride None

#we want specific log file for this server
CustomLog /var/log/apache2/abc.com-access.log combined
ErrorLog /var/log/apache2/abc.com-error.log

</VirtualHost>

* Now create another file mydomain.com.conf
* copy this to mydomain.com.conf, make changes to folder path domain name etc. and Save the file. Note that here I am assuming mydomain.com will actually redirect to an app server (like tomcat or jboss) running on port 8080, that’s why you see ProxyPass statements:


<VirtualHost *:80>

DocumentRoot /var/www/mysecondapp/
ServerAdmin admin@mydomain.com
ServerName mydomain.com
ServerAlias www.mydomain.com

Options FollowSymLinks
AllowOverride None

ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
ProxyPreserveHost on

#if using awstats
ScriptAlias /awstats/ /usr/lib/cgi-bin/
#we want specific log file for this server
CustomLog /var/log/apache2/mydomain.com-access.log combined
ErrorLog /var/log/apache2/mydomain.com-error.log

# if your machine's name is also mydomain.com
# then you need to use config settings below
# otherwise site will NOT be accessible with mydomain.com
# (although it will be accessble as www.mydomain.com)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]

</VirtualHost>

* on command line run these commands to enable these 2 configs:

a2ensite abc.mydomain.com.conf
a2ensite mydomain.com.conf

This creates symlinks to the 2 config files in /etc/apache2/sites-enabled folder
You can create the same symlinks manually also like this:

cd /etc/apache2/sites-enabled
ln -s /etc/apache2/sites-available/abc.mydomain.com.conf abc.mydomain.com.conf
ln -s /etc/apache2/sites-available/mydomain.com.conf mydomain.com.conf

* Following step is required only if your machine’s name is also mydomain.com (that means you sftp or ssh to your machine using mydomain.com). In this case I was not able to access my site using mydomain.com in browser. Hence I did this which worked, there may be a different way to solve this problem though:

remove symlink to ln -s /etc/apache2/sites-available/default file from /etc/apache2/sites-enabled folder. You can use rm command or you can run this command

a2dissite default

You do not need to do this for sub-domains (like abc.mydomain.com)

* Restart apache (/etc/conf.d/apache restart)
* Your sites should be accessible now

Note : If it does not work make sure you do not have ProxyPass statements inside httpd.conf or a conf file in /etc/apache2/conf.d to redirect URL

Javascript – extract Year from Date

June 24th, 2011 § Leave a Comment

If you want to extract year from Date in Javascript, try getFullYear() method instead of getYear(), see the output below on Firefox and Chrome…

Here's the code:

<html>
<head>
<script langauge="javascript">
var date1 = new Date();
var browser = navigator.userAgent;
var dateMessage = "I am on "+browser+"\n\nCurrent Date : "+
	date1;
dateMessage += "\ndate1.getYear()>> "+date1.getYear()+
	"\ndate1.getFullYear()>> "+date1.getFullYear();
alert(dateMessage);
</script>
</head>
</html>

CSS, DIV and Table Wrap Problem

May 19th, 2011 § 1 Comment

I had this table within a DIV


<div id="tooltip_123" class="tooltip">
<table class="tooltip">
<tbody>
<tr>
<td>
The Business Communication System bundle combines an ADTRAN NetVanta 7100 or NetVanta 7060 with the NetVanta Unified Communications software to give the customer Unified Messaging providing access to voice mail and faxes within an email or desktop client. This solution provides a Fax Server, Personal Assistants, Graphical Drag-and-Drop Service Creation, Call Redirection Services, and Notifications. This solution requires a separate server to run the UC software. A server is not included in the BCS bundle.
Click here for more information.
</td>
</tr>
</tbody>
</table>
</div>

And CSS properties were:


div.tooltip { position: absolute; z-index: 1; white-space:pre-wrap; }
table.tooltip { border-collapse: collapse; width: 250px; color: #000; font-size: 10pt; border-width: 4px; border-color: #013777; }

This is what was showing up on screen

After some research, I changed DIV css to this:

div.tooltip { position: absolute; z-index: 1; visibility: hidden; white-space:pre-wrap;  }

and now it wrapped text without any problem and I see this now (white-space:pre-wrap; keeps white spaces as entered and wraps text when required):

Where Am I?

You are currently browsing the Web Development category at Varun's Blog.

Follow

Get every new post delivered to your Inbox.