I am facing problem in defining beans and injecting it back.
Below code works fine in eap5
@Resource(mappedName="queue/request_queue")
But in eap6 queue names should be like "java:/queue/request_queue", so i changed the queue name and injected like
@Resource(mappedName="java:/queue/request_queue"), this worked in EAP6 but its failing in EAP5, saying jndi name not in correct format.
Now, i need a permanent fix to solve this. Can we generate this jndi name dynamically during deployment time and inject in @Resource like
@Resource(mappedName=<<SOMECONSTANT>>), as far as i have seen constants should be declared during compile time itself, but then how to address this problem ???
NOTE: if i fix this by doing workaround like removing @Resource and intialising object using @PostConstruct this piece works fine. BUT i am not able define it in MDB
@MessageDriven(name = "SOMEMDBNAME", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = <<<QUEUENAME>>>),
})
here <<<QUEUENAME>>> should be given as constant during compile time, so here also i endup in editing this according to AppServer.
So is there any permanent solution which will make my code work in both EAP5 & EAP6"
You might use an application local JNDI name defined in the ejb-jar.xml and map it to the external one, in that case the change is only inside the deployment descriptor.