Hi,

i'm having an issue with EJB bindings which i can not resolve. To make it short, i have one project which is deployed several times (political manner), so i do have EJBs with the same name.
I found 2 solutions, 1) defining a custom property on the JVM (which is not allowed internally) for long-form names, and 2) defining a binding file "ibm-ejb-jar-bnd.xml".

I have tried to replicate what this file does, and "hard code" the bindings directly on the application instance. While accessing the context-root, i get a ClassCastException :
Code:
DefaultDispat E com.opensymphony.xwork2.util.logging.commons.CommonsLogger error Exception occurred during processing request: Cannot cast class my.project.ejb.service.EJSLocal0SLCartService_14538494 to interface my.project.ejb.service.ICartService
java.lang.ClassCastException: Cannot cast class my.project.ejb.service.EJSLocal0SLCartService_14538494 to interface my.project.ejb.service.ICartService
at java.lang.Class.cast(Class.java:2632)
...
To distinguish between the instances that will be installed, i set a variable during compiling with Maven. So, the bindings will be adapted.

Local:
Code:
@Local
public interface ICartService {
Implementation:
Code:
@Stateless
public class CartService implements ICartService{
@EJB
private IAuditTrailService auditTrailSvc; // Other EJB
I do EJB injection. Can not use InitialContext as the bindings will be different from instance to instance.

Code:
binding file "ibm-ejb-jar-bnd.xml":
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar-bnd
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_0.xsd"
version="1.0">

<session name="CartService" simple-binding-name="ejb/app1/ICartService"/>
</ejb-jar-bnd>
I'm using EJB 3.1, Java 7, WAS 8.5.

Can somebody help me out ?

(I can change the application like i want, but do not have the possibility to change any configuration on the production server.)

Thanks !