I’ve got a complaint from one of the developers: the JMS resources, defined in his local instance of Weblogic server, are defined correctly, but he can’t use them from the application he developing – the names are not present in JNDI tree. The problem is that in our environment the same scripts are used to create all Weblogic instances, from local development through production.

Quick look through Weblogic Console JNDI browser confirmed that the JMS resources are not in the tree. I took a look for exceptions or errors in the log files – everything looks ok, the logs are clean. Then I tried to change one of the parameters of the JMS resources and then Weblogic complained with the message saying that JMS resource is not yet started. And in the console it looks like it started ok.

Then I took a look at the Git logs of the recent changes for this type of the Weblogic domain and the only change was an introduction of the JDBCStores for JMS resources. But where are local development machines are pointed to? Is it local Oracle XE database? No, they are pointed to the shared database, used by other environment. This is clearly wrong! I don’t think that JDBCStore implementation is smart enough to recognise that connections are coming from different domains. So I removed JDBCStore usage from development domain and restarted it – voila, JMS resources are now in JNDI tree!

So Weblogic was misconfigured, but was silently ignoring the fact that it can not recognise data from JDBCStore and manifested it through JNDI tree. How weird!

Sometimes I don’t want to update everything on my Ubuntu, but I want to keep it up to date with all patched security holes. At the same time I don’t like when updates happen automatically, like Ubuntu documentation suggests.

This is the way to apply only security fixes:

1. Copy update sources list to a new file

 Bash |  copy code |? 
1
sudo cp /etc/apt/sources.list /etc/apt/security.sources.list

2. Comment out everything in new file, but leave only security repositories

3. Use following command to apply updates using new file:

 Bash |  copy code |? 
1
sudo apt-get upgrade -o Dir::Etc::SourceList=/etc/apt/security.sources.list

I created an alias in my .bash_aliases for it:

 Bash |  copy code |? 
1
alias updatesecurity='sudo apt-get upgrade -o Dir::Etc::SourceList=/etc/apt/security.sources.list'

Now I simply type updatesecurity to stay up to date.

I found this solution via ServerFault.com

Install Sun Java:

 Bash |  copy code |? 
1
sudo vi /etc/apt/sources.list

 Bash |  copy code |? 
1
deb http://archive.canonical.com/ubuntu maverick partner

 Bash |  copy code |? 
1
sudo apt-get update
2
sudo apt-get install sun-java6-jdk

Install Google Chrome unstable:

Add this to /etc/apt/sources.list:

 Bash |  copy code |? 
1
deb http://dl.google.com/linux/deb/ stable non-free main

 Bash |  copy code |? 
1
sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub > google.pub
2
sudo apt-key add google.pub 
3
sudo apt-get update
4
sudo apt-get install google-chrome-unstable

I decided to save Hudson configs to Subversion repository just in case something goes wrong with the server later and would need to restore all projects. A bit of googling first, found that there are plugins to to a backup of workplaces and configs. But why would I need to have them? I am on Solaris, so I can create the same by my own hands. Here are my requirements:

  1. Backup should be a job within Hudson – since Hudson is a best cron you could find and I already have it
  2. Backup should automatically discover added jobs and add then into Subversion – thus I will forget about it forever, no maintenance required

Simples! So I created a custom build job within Hudson, pointed it to a Subversion location, where I will store backups and backup shell script, which will gather all Hudson configs and deal with Subversion. I told Hudson that I don’t want to create subfolder for a project within its workplace. Then I set to execute script this way: ${WORKPLACE}/hudsonbackup.sh Here is the script itself:

 Bash |  copy code |? 
01
#!/bin/bash
02
 
03
SRC_FOLDER=${WORKSPACE}
04
SVN_PARAMS="--config-dir /.subversion/ --non-interactive --trust-server-cert --username f_tc_ci1 --password *****"
05
SVN_COMMAND="/opt/csw/bin/svn"
06
JOBS=`ls -al /.hudson/jobs/|grep -v job1|grep -v job2|awk ' NR>3 {print $9}'`
07
 
08
CURR_FOLDER=`pwd`
09
 
10
echo "Copying Hudson configs"
11
cp /.hudson/*.xml ${SRC_FOLDER}
12
echo "Done."
13
 
14
cd ${SRC_FOLDER}
15
 
16
echo "Processing Hudson jobs"
17
for JOB in ${JOBS}
18
do
19
  echo "Processing ${JOB}"
20
  if [ ! -e ${JOB} ]
21
  then
22
    echo "New job. Creating folder and adding it to SVN"
23
    mkdir  ${JOB}
24
    ${SVN_COMMAND} add ${SVN_PARAMS} ${JOB}    
25
    SVN_COMMENT="${SVN_COMMENT} Added ${JOB}"
26
  fi  
27
 
28
  echo "Saving ${JOB}/config.xml"
29
  if [ -e ${JOB}/.svn ]
30
  then
31
    if [ -e ${JOB}/config.xml ]
32
    then
33
      # config.xml already exist - don't need to add it to subversion
34
      cp /.hudson/jobs/${JOB}/config.xml ${JOB}/
35
    else
36
      echo "New job - new config.xml"
37
      cp /.hudson/jobs/${JOB}/config.xml ${JOB}/
38
      ${SVN_COMMAND} add ${SVN_PARAMS} ${JOB}/config.xml
39
    fi
40
  else
41
    echo "Problem creating and adding folder to Subversion"
42
    exit 1
43
  fi
44
done
45
 
46
echo "Job processing is done. Committing..."
47
${SVN_COMMAND} ci ${SVN_PARAMS} -m "Config saved by Hudson. ${SVN_COMMENT}"
48
echo "All done."

Note 1: My Subversion is on HTTPS server with the self-signed certificate, so I have to tell Subversion client to trust it explicitly. Its on line 4. On line 5 I constructed the path to Subversion client because Hudson executing shell scripts with quite limited PATH. Note 2: I need to ignore some jobs, so I added them on line 6. Also on this line I have hardcoded Hudson location (“/.hudson”) – it needs to be changed if your Hudson somewhere else. After all that I set this job to execute daily. It works!

find . -name "*.ext" -exec grep -i -H -n "texttofind" {} ;

I am installing Postfix on my unmanaged VPS hosting machine and I am doing it first time ever. I followed the installation manual on Ubuntu site and everything looks all right except one tiny thing: I can’t send email using Telnet. Here is the response:

421 4.3.0 collect: Cannot write ./dfnBA9gfVO030273 (bfcommit, uid=0, gid=111): No such file or directory

I googled for an answer, but nothing useful came up so I tried to debug the problem myself. By looking into mail logs (/var/log/mail.log, found by examining /etc/syslog.conf) I found following strange response:

 start postfix/master[15758]: fatal: bind 0.0.0.0 port 25: Address already in use

That means only one thing: there is another process listening on this port. Hmm, what could it be? Sendmail, perhaps. I uninstalled it, according to guides I was using, but it was still running.

It’s time to stop it and start postfix!

sudo service sendmail stop

sudo service postfix restart

 

Problem solved!

Moved my blog to a cheaper VPS. Also now this blog is served by Lighttpd instead of Apache. Everything seems to be a bit faster!

This is most frustrating thing that I experience when I encounter Solaris bash prompt: the Home, End and Delete keyboard keys will not work because for some reason Solaris doesn’t understand them as useful keys. But there is the way to enable those keys!

Add following lines to your ~/.bashrc file:

# home key
bind ‘"e[1~":beginning-of-line’
# del key
bind ‘"e[3~":delete-char’
# end key
bind ‘"e[4~":end-of-line’
# pgup key
bind ‘"e[5~":history-search-forward’
# pgdn key
bind ‘"e[6~":history-search-backward’

Save and source file. Now keys will work as they should.

I use VMWare to run a bunch of different Linux VMs on my home PC, which is running Vista SP1. Today I encountered strange thing: Linux VM won’t get an IP address from VMWare DHCP. I’ve opened VMWare Virtual Networks management console (as Administrator, of course, or it won’t let you make and save any changes) just to find out that DHCP service is not started. I tried to start it from there, but it failed to do so.

So I went to Vista Services console and tried to start “VMWare DHCP service from there”. Again, failed to start with no explanation, even cryptic one. So I went to Windows Events viewer and there, under Windows Logs-System, I found a lot of messages from VMNetDHCP:


The description for Event ID 2 from source VMnetDHCP cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

Can’t open C:ProgramDataVMwarevmnetdhcp.conf: Access is denied.

/ The data is invalid

the message resource is present but the message is not found in the string/message table

Though the message says that the message is not found, it has enough information to fix the problem.

So, I’ve taken a look at the security properties for C:ProgramDataVMWare folder and found that SYSTEM account somehow is not in a list of permitted users. The only account, who was permitted to access that folder, was my Windows user account. So I added SYSTEM account with all permissions to this folder, waited when Windows propagated my change to all files and tried to start VMWare DHCP service again. It worked!

Then I simply restarted network within Linux VM (sudo /etc/init.d/networking restart) and got back to work.

I created sample JBOSS Seam project in Eclipse and decided to generate entity code from  existing database. It worked fine, but when I try to run it, it shows me that Hibernade is not able to map entity beans to the corresponding tables. The error message is like this:

org.hibernate.hql.ast.QuerySyntaxException: <your table> is not mapped

I spent around three hours trying to read all available information on it, but most of it just useless – it looks like people don’t know whats happening, so they recommend bizarre tricks. Like, for example, having empry seam.settings file in each folder, meh.

Finally, I found the solution in Seam Jira: https://jira.jboss.org/jira/browse/JBSEAM-3821

They rocemmend to to force Hibernate to use Seam’s EntityManager by changing two files:

1. components.xml

    <persistence:entity-manager-factory name="bookingDatabase" installed="false"/>
    <!– If Seam loads the persistence unit (JBoss 4.x), the EntityManagerFactory will be resolved from #{bookingDatabase}.
         On JBoss AS 5, the EntityManagerFactory is retrieved from JNDI (the binding occurs during application deployment). –>
    <persistence:managed-persistence-context name="em" auto-create="true"
       entity-manager-factory="#{bookingDatabase}" persistence-unit-jndi-name="java:/bookingEntityManagerFactory"/>

2. persistence.xml

<!– Binds the EntityManagerFactory to JNDI where Seam can look it up.
              This is only relevant when the container automatically loads the persistence unit, as is the case in JBoss AS 5. –>
         <property name="jboss.entity.manager.factory.jndi.name" value="java:/bookingEntityManagerFactory"/>

Hope that Google will find that page and the proper solution would be much more easily found!

© 2011 Days of ...Suffusion theme by Sayontan Sinha