Wednesday, 29 February 2012

Deploy to Tomcat instance on Eclipse - Steps for Maven enabled projects.

A while ago I was looking for an approach to enable Maven deploy Java web Applications to Tomcat server installed on my eclipse IDE. Did some googling around and did not find anything relevant to my search, and so came up with this approach.
  1. Expand Servers directory as shown in your projects package view
  2. Create a new dir = instances
  3. Open Server view from -> Window -> Show Percpective -> Servers
  4. Double click on the server instance to view its config overview.
  5. On Configuration path: point it to "Servers/tc-6.0.32-config"

  6. From "Server Locations" select the radio button, select "Use custom location"
  7. Server path: point it to "Servers\tc-6.0.32-config\instances"
    Note: Your final config overview should look something like this:
























  8. Now lets save it and ask Maven to generate the target output to our instances directory created above.
  9. Ctrl + S to save the changes.
  10. In your POM file add this line:
          
            org.apache.maven.plugins
            maven-war-plugin
            ${war.plugin.version}
            
              
                ../Server/ts-6.0.32/instance/webapps/name_of_project_for_easy_identification
              
           [..] 
           
          
    
  11. Right click your Maven project select Run As -> build or alternatively execute:
      clean install -X -Dmaven.test.skip.exec=true
    
  12. Select your Servers directory and refresh. Maven will push build files to both targets and your instances/webapps location described above.
  13. Finally Start your server and job done.
Hope it helps you.

Monday, 27 February 2012

/usr/bin/ld: cannot find -lltdl collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1

This culprit emits error to indicates your build ./configure options require additional library file to be installed before PHP can proceed successfully with the build process. The solution described here assumes you're building the sources to install or re-installing PHP manually. Your ./configure option either looks or have options similar to the one shown below:
./configure --enable-embed --enable-maintainer-zts --disable-short-tags --enable-pcntl --with-tsrm-pthreads --with-mysqli --with-mysql --with-
pdo-mysql --with-zlib --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-bcmath --enable-calendar --enable-exif --enable-ftp --with-gd 
--enable-gd-native-ttf --enable-gd-jis-conv --with-iconv-dir --with-gettext --with-imap --with-imap-ssl --with-ldap --with-ldap-sasl --enable-
mbstring --with-mcrypt --with-mhash --enable-soap --enable-sockets --enable-wddx --with-xmlrpc --with-xsl --enable-zip --with-kerberos --with-tidy 
--with-curl --with-curlwrappers

SOLUTION.
First lets take a look at the error again.
/usr/bin/ld: cannot find -lltdl 
collect2: ld returned 1 exit status make: *** [libphp5.la] Error 1
The portion we are interested is cannot find -lltdl, this tells us the header file libltdl.so cannot be found. To resolve this:
  • Install the header file via
    apt-get install libtool
  • If you're configuring for MySQL, install libdbd-mysql
    apt-get install libdbd-mysql
  • Run
    make clean
    ./configure -- with your additonal configure options
    make
    make install
    
If you do have any other error related to your additional configure options, see here for resolutions. Good luck.

Friday, 24 February 2012

Can't locate package Exporter for @PHP::Interpreter::ISA

The last time I caught a culprit was a while ago, and so when I saw this exception, did not hessitate to post the solution right away to fill in the gap. I was performing sys_log analysis this afternoon with Perl and decided to use PHP::Interpreter module to connect to POD for data persistence. ..fired first line syntax to PHP::Interpreter:
my $php_ = PHP::Interpreter->new;
then suddenly, Gotcha! the culprit below.
Can't locate package Exporter for @PHP::Interpreter::ISA at /usr/local/lib/perl/5.10.1/PHP/Interpreter.pm line 35.
Can't locate package Exporter for @PHP::Interpreter::ISA at /usr/lib/perl/5.10/DynaLoader.pm line 193.
Although I have to be honest, it still does the interpretation, I thought! gotta shut this up before future issues. And so got my eyes peeled and poked through the Interpreter.pm module for clues.

Solution
The solution was pretty simple if not obvious at first hand. Add below line of syntax to the Interpreter.pm module.
use Exporter "import";
right after the the line of syntax
require DynaLoader;
Perl's Exporter module allows modules to "export" identifiers (i.e., variable and subroutine names) into the calling program's namespace. See Exporter for more infomation on importing modules to perl function namespace.