I solved the problem by finding a post on some forum which states:
Disable GlassFish Server v2 Vendor-Specific JNDI Names
The EJB 3.1 specification supported by GlassFish Server 3.1 defines portable EJB JNDI names. Because of this, there is less need to continue to use older vendor-specific JNDI names.
By default, GlassFish Server v2–specific JNDI names are applied automatically by GlassFish Server 3.1 for backward compatibility. However, this can lead to some ease-of-use issues. For example, deploying two different applications containing a Remote EJB component that exposes the same remote interface causes a conflict between the default JNDI names.
The default handling of v2–specific JNDI names in GlassFish Server 3.1 can be managed with the asadmin command or with the disable-nonportable-jndi-names boolean property for the ejb-container element in glassfish-ejb-jar.xml.
Use the asadmin command or directly modify the glassfish-ejb-jar.xml file to set the disable-nonportable-jndi-names property.
Using the asadmin command:
asadmin> set server.ejb-container.property.disable-nonportable-jndi-names="true"
Directly modifying the glassfish-ejb-jar.xml file.
Add the disable-nonportable-jndi-names property to the ejb-container element in glassfish-ejb-jar.xml.
Set the value of the disable-nonportable-jndi-names boolean, as desired.
false — Enables the automatic use of GlassFish Server v2–specific JNDI names. This is the default setting.
true — Disables the automatic use of v2–specific JNDI names. In all cases, 3.1-compatible JNDI names will be used.
Save the glassfish-ejb-jar.xml file and restart the GlassFish Server domain. This setting applies to all EJBs deployed to the server.