welcome to my blog !

My name is Aleksey Maksimov. I am Software Architect with many years of IT experience and architecture experience. I work for a global IT consulting company and live in the United Kingdom. This is my software rants blog. I also have blog about my life happenings, in Russian. I also registered in almost all social networks, usually as ctpeko3a, sometimes as lechat and rarely as drunkenfly. Here is my FriendFeed and View my profile on LinkedIn.

January 06 2010

Recursive Linux “Find Files Containing”

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

December 10 2009

Problem testing Postfix

Tagged Under : , , , ,

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!

May 08 2009

VMWare DHCP service wont’start – SOLVED

Tagged Under : , , ,

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:\ProgramData\VMware\vmnetdhcp.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:\ProgramData\VMWare 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.

May 07 2009

JBOSS Seam 2.1.1GA on JBOSS AS 5.0.1GA: Table is not mapped

Tagged Under : , , , , , ,

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!