java ee - Glassfish and javax.naming.NameNotFoundException after app Reload -


environment:

glassfish server open source edition 4.1

disable-nonportable-jndi-names: true

the problem:

when deploy or redeploy application - works ok. after reload or disable/enable following exception arises during connection standalone client:

exception in thread "main" javax.naming.namingexception: lookup failed 'java:global/synisbackendear/synisbackend/unitronicsdriver'...

...

caused by: javax.naming.namenotfoundexception: unitronicsdriver not found...

...

caused by: java.lang.illegalstateexception: exception attempting inject local ejb-ref name=com.protechnologia.synis.drivers.unitronics.unitronicsdriver/configurationprovider,local 3.x interface =com.protechnologia.synis.settings.configurationprovider,ejb-link=null,lookup=java:app/synisbackend/configurationproviderxml,mappedname=,jndi-name=,reftype=session class com.protechnologia.synis.drivers.unitronics.unitronicsdriver: object not instance of declaring class

...

the code of standalone client:

initialcontext ctx = new initialcontext(); driver bean = (driver) ctx.lookup("java:global/synisbackendear/synisbackend/unitronicsdriver"); bean.test(); 

i want mention, after deployment or redeployment works ok.

the clue:

i've found taht problem in following lookup taht working on deplyment , not working otherwise:

@singleton @startup public class unitronicsdriver implements driver {      @ejb(lookup = "java:app/synisbackend/configurationproviderxml")     protected configurationprovider conf; 

next clue:

replacing @ejb manual lookup solves problem why?

conf = (configurationprovider) ctx.lookup("java:app/synisbackend/configurationproviderxml"); 

finally - found it!!!

the problem was, ejb wanted inject in implementing @remote interface instead of @local.

it has wit pass-by-reference issue @remote interdaces.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -