[Security & JAAS/JBoss] - SessionContext not set for Stateful bean when invoked from J
by andrewv
Hi,
I am having the following problem with:
AS 4.0.5.GA, EJB3 1.0.0.CR9-patch1-jboss4.0.5, Portal 2.4.1.SP1,
JBossWS 1.0.3.SP1
I have a stateful bean on the server side, where I
want the SessionContext injected:
import org.apache.log4j.Logger;
@Stateful()
@SecurityDomain("other")
@Local(AlarmHistoryService.class)
public class AlarmHistoryServiceBean implements AlarmHistoryService
{
private static final Logger logger = Logger
.getLogger(AlarmHistoryServiceBean.class);
SessionContext sessionContext;
@Resource
public void setSessionContext(SessionContext sessionContext)
{
try
{
logger.info("sessionContext user:"
+ sessionContext.getCallerPrincipal().getName());
} catch (Throwable e)
{
logger.error(e);
}
this.sessionContext = sessionContext;
}
@PostConstruct
public void postConstruct()
{
logger.info("postConstruct: ");
}
public void initiateAlarmHistoryQuery()
{
logger.info("initiateAlarmHistoryQuery: ");
}
// ...
}
I think that maybe the wrong SecurityDomain is being used, because the
principal is null initially, but then later, after postConstruct() and
just prior to the call to initiateAlarmHistoryQuery(), I can see the
user/password/domain being set correctly.
Can anyone tell me why the SessionContext is null when
setSessionContext is called ?
See log extract below ...
Thanks
Andrew
And I have configured:
server\nxa\conf\roles.properties
================================
myuser=myrole
nxa\conf\users.properties
=========================
myuser=mypassword
server\nxa\conf\login-config.xml
================================
...
<application-policy name = "other">
<login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
flag = "required">
<module-option name="unauthenticatedIdentity">nobody</module-option>
</login-module>
<login-module code="org.jboss.security.ClientLoginModule" flag="required">
<module-option name="restore-login-identity">true</module-option>
<module-option name="multi-threaded">true</module-option>
</login-module>
</application-policy>
...
>From my client,
Hashtable<String, String> p = new Hashtable<String, String>();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.security.jndi.LoginInitialContextFactory");
p.put(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, jndiAddressString);
p.put(Context.SECURITY_PRINCIPAL, "myuser");
p.put(Context.SECURITY_CREDENTIALS, "mypassword");
p.put(Context.SECURITY_PROTOCOL, "other");
InitialContext ic = new InitialContext(p);
AlarmHistoryService as = (AlarmHistoryService) ic.lookup(
StringConstants.ALARM_HISTORY_SERVICE_BEAN_JNDI_NAME);
as.initiateAlarmHistoryQuery();
...
client side auth.conf
=====================
other {
org.jboss.security.ClientLoginModule required
;
};
And pass to VM:
-Djava.security.auth.login.config=auth.conf
Server log extract
==================
03/17-20:15:36.639,TRACE,7.76.48.139:37404)#1: .plugins.JaasSecurityManager.HsqlDbRealm: defaultLogin, lc=javax.security.auth.login.LoginContext@12fa7c8, subject=Subject(28329295).principals=org.jboss.security.SimplePrincipal@26810747(sa)
03/17-20:15:36.639,TRACE,7.76.48.139:37404)#1: .plugins.JaasSecurityManager.HsqlDbRealm: updateCache, inputSubject=Subject(28329295).principals=org.jboss.security.SimplePrincipal@26810747(sa), cacheSubject=Subject(26629315).principals=org.jboss.security.SimplePrincipal@26810747(sa)
03/17-20:15:36.640,TRACE,7.76.48.139:37404)#1: .plugins.JaasSecurityManager.HsqlDbRealm: Inserted cache info: org.jboss.security.plugins.JaasSecurityManager$DomainInfo@96de68[Subject(26629315).principals=org.jboss.security.SimplePrincipal(a)26810747(sa),credential.class=null,expirationTime=1205747132136]
03/17-20:15:36.640,TRACE,7.76.48.139:37404)#1: .plugins.JaasSecurityManager.HsqlDbRealm: End isValid, true
03/17-20:15:36.640,TRACE,7.76.48.139:37404)#1: urity.auth.spi.DatabaseServerLoginModule: Excuting query: SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?, with username: guest
03/17-20:15:36.641,TRACE,7.76.48.139:37404)#1: urity.auth.spi.DatabaseServerLoginModule: Assign user to role guest
03/17-20:15:36.641,TRACE,7.76.48.139:37404)#1: urity.auth.spi.DatabaseServerLoginModule: Assign user to role j2ee
03/17-20:15:36.642,TRACE,7.76.48.139:37404)#1: urity.auth.spi.DatabaseServerLoginModule: Assign user to role john
03/17-20:15:36.642,TRACE,7.76.48.139:37404)#1: urity.auth.spi.DatabaseServerLoginModule: resumeAnyTransaction
03/17-20:15:36.642,TRACE,7.76.48.139:37404)#1: rity.plugins.JaasSecurityManager.jbossmq: defaultLogin, lc=javax.security.auth.login.LoginContext@11591e3, subject=Subject(18668012).principals=org.jboss.security.SimplePrincipal@26810747(guest)org.jboss.security.SimpleGroup@9757812(Roles(members:j2ee,guest,john))
03/17-20:15:36.642,TRACE,7.76.48.139:37404)#1: rity.plugins.JaasSecurityManager.jbossmq: updateCache, inputSubject=Subject(18668012).principals=org.jboss.security.SimplePrincipal@26810747(guest)org.jboss.security.SimpleGroup@9757812(Roles(members:j2ee,guest,john)), cacheSubject=Subject(19339680).principals=org.jboss.security.SimplePrincipal@26810747(guest)org.jboss.security.SimpleGroup@9757812(Roles(members:j2ee,guest,john))
03/17-20:15:36.643,TRACE,7.76.48.139:37404)#1: rity.plugins.JaasSecurityManager.jbossmq: Inserted cache info: org.jboss.security.plugins.JaasSecurityManager$DomainInfo@37ad8[Subject(19339680).principals=org.jboss.security.SimplePrincipal@26810747(guest)org.jboss.security.SimpleGroup@9757812(Roles(members:j2ee,guest,john)),credential.class=null,expirationTime=1205747134226]
03/17-20:15:36.643,TRACE,7.76.48.139:37404)#1: rity.plugins.JaasSecurityManager.jbossmq: End isValid, true
03/17-20:15:36.670,DEBUG,7.76.48.139:37404)#1: ss.mq.il.uil2.ServerSocketManagerHandler: Setting up the UILClientIL Connection
03/17-20:15:36.670,DEBUG,7.76.48.139:37404)#1: ss.mq.il.uil2.ServerSocketManagerHandler: The UILClientIL Connection is set up
03/17-20:15:36.704,TRACE,7.76.48.139:37404)#1: org.jboss.security.SecurityAssociation : getPrincipal, principal=null
03/17-20:15:36.704,TRACE,7.76.48.139:37404)#1: .plugins.JaasSecurityManager.HsqlDbRealm: Begin isValid, principal:null, cache info: org.jboss.security.plugins.JaasSecurityManager$DomainInfo@96de68[Subject(26629315).principals=org.jboss.security.SimplePrincipal(a)26810747(sa),credential.class=null,expirationTime=1205747132136]
03/17-20:15:36.704,TRACE,7.76.48.139:37404)#1: .plugins.JaasSecurityManager.HsqlDbRealm: Begin validateCache, info=org.jboss.security.plugins.JaasSecurityManager$DomainInfo@96de68[Subject(26629315).principals=org.jboss.security.SimplePrincipal(a)26810747(sa),credential.class=null,expirationTime=1205747132136];credential.class=null
03/17-20:15:36.704,TRACE,7.76.48.139:37404)#1: .plugins.JaasSecurityManager.HsqlDbRealm: End validateCache, isValid=true
03/17-20:15:36.704,TRACE,7.76.48.139:37404)#1: .plugins.JaasSecurityManager.HsqlDbRealm: End isValid, true
03/17-20:15:37.080,TRACE,(1080)-147.76.48.139: org.jboss.security.SecurityAssociation : pushSubjectContext, subject=null, sc=org.jboss.security.SecurityAssociation$SubjectContext@a5d04b{principal=null,subject=null}
03/17-20:15:37.081,TRACE,(1080)-147.76.48.139: org.jboss.security.SecurityAssociation : popSubjectContext, sc=org.jboss.security.SecurityAssociation$SubjectContext@a5d04b{principal=null,subject=null}
03/17-20:15:37.088,TRACE,(1080)-147.76.48.139: org.jboss.security.SecurityAssociation : pushSubjectContext, subject=null, sc=org.jboss.security.SecurityAssociation$SubjectContext@122effd{principal=null,subject=null}
03/17-20:15:37.088,TRACE,(1080)-147.76.48.139: org.jboss.security.SecurityAssociation : popSubjectContext, sc=org.jboss.security.SecurityAssociation$SubjectContext@122effd{principal=null,subject=null}
03/17-20:15:37.149,TRACE,(1080)-147.76.48.139: org.jboss.security.SecurityAssociation : pushSubjectContext, subject=null, sc=org.jboss.security.SecurityAssociation$SubjectContext@17f3ef0{principal=null,subject=null}
03/17-20:15:37.151,TRACE,(1080)-147.76.48.139: org.jboss.security.SecurityAssociation : popSubjectContext, sc=org.jboss.security.SecurityAssociation$SubjectContext@17f3ef0{principal=null,subject=null}
03/17-20:15:38.743,DEBUG,read-147.76.48.139-0: s.remoting.transport.socket.ServerThread: beginning dorun
03/17-20:15:39.123,INFO ,read-147.76.48.139-0: server.alarm.ejb.AlarmHistoryServiceBean: AlarmHistoryServiceBean.AlarmHistoryServiceBean:
03/17-20:15:39.131,TRACE,read-147.76.48.139-0: org.jboss.security.SecurityAssociation : getCallerPrincipal, principal=null
03/17-20:15:39.131,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: getPrincipal, cache info: null
03/17-20:15:39.131,ERROR,read-147.76.48.139-0: server.alarm.ejb.AlarmHistoryServiceBean: AlarmHistoryServiceBean.setSessionContext:
java.lang.IllegalStateException: No valid security context for the caller identity
at org.jboss.ejb3.BaseSessionContext.getCallerPrincipal(BaseSessionContext.java:182)
at nstc.nxa.server.alarm.ejb.AlarmHistoryServiceBean.setSessionContext(AlarmHistoryServiceBean.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.injection.EJBContextMethodInjector.inject(EJBContextMethodInjector.java:55)
at org.jboss.injection.EJBContextMethodInjector.inject(EJBContextMethodInjector.java:46)
at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:92)
at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:48)
at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:209)
at org.jboss.ejb3.stateful.StatefulContainer.createSession(StatefulContainer.java:229)
at org.jboss.ejb3.stateful.StatefulLocalProxyFactory.createProxy(StatefulLocalProxyFactory.java:100)
at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:52)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1061)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:700)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at org.jboss.injection.JndiFieldInjector.lookup(JndiFieldInjector.java:80)
at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:110)
at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:104)
at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:61)
at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:92)
at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:48)
at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:209)
at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:303)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
03/17-20:15:39.138,INFO ,read-147.76.48.139-0: server.alarm.ejb.AlarmHistoryServiceBean: AlarmHistoryServiceBean.postConstruct:
03/17-20:15:39.139,TRACE,read-147.76.48.139-0: org.jboss.security.SecurityAssociation : pushSubjectContext, subject=null, sc=org.jboss.security.SecurityAssociation$SubjectContext@1e8ab07{principal=null,subject=null}
03/17-20:15:39.139,TRACE,read-147.76.48.139-0: org.jboss.security.SecurityAssociation : popSubjectContext, sc=org.jboss.security.SecurityAssociation$SubjectContext@1e8ab07{principal=null,subject=null}
03/17-20:15:39.139,DEBUG,read-147.76.48.139-0: history.InmsAlarmHistoryServerConnection: (O) alarmHistoryServer@oberon:55021 alarmHistoryServer.createSession()
03/17-20:15:39.145,INFO ,read-147.76.48.139-0: history.InmsAlarmHistoryServerConnection: InmsAlarmHistorySessionService.establishNewSession: sessId:258145178
03/17-20:15:39.145,INFO ,read-147.76.48.139-0: history.InmsAlarmHistoryServerConnection: (O) alarmHistoryServer@oberon:55021 alarmHistoryServer.createSession() RSP 6ms
03/17-20:15:39.145,DEBUG,read-147.76.48.139-0: history.InmsAlarmHistoryServerConnection: (O) alarmHistoryServer@oberon:55021 alarmHistoryServer.registerForNotifications(258145178)
03/17-20:15:39.145,INFO ,read-147.76.48.139-0: history.InmsAlarmHistoryServerConnection: InmsAlarmHistorySessionService.registerForNotifications: Start alarm notifications for sessId:258145178
03/17-20:15:39.148,INFO ,read-147.76.48.139-0: history.InmsAlarmHistoryServerConnection: (O) alarmHistoryServer@oberon:55021 alarmHistoryServer.registerForNotifications(258145178) RSP 3ms
03/17-20:15:39.173,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: Begin isValid, principal:myuser, cache info: null
03/17-20:15:39.174,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: defaultLogin, principal=myuser
03/17-20:15:39.174,TRACE,read-147.76.48.139-0: s.security.auth.login.XMLLoginConfigImpl: Begin getAppConfigurationEntry(other), size=8
03/17-20:15:39.174,TRACE,read-147.76.48.139-0: s.security.auth.login.XMLLoginConfigImpl: End getAppConfigurationEntry(other), authInfo=AppConfigurationEntry[]:
[0]
LoginModule Class: org.jboss.security.auth.spi.UsersRolesLoginModule
ControlFlag: LoginModuleControlFlag: required
Options:name=unauthenticatedIdentity, value=nobody
[1]
LoginModule Class: org.jboss.security.ClientLoginModule
ControlFlag: LoginModuleControlFlag: required
Options:name=restore-login-identity, value=true
name=multi-threaded, value=true
03/17-20:15:39.184,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: initialize, instance=@13406605
03/17-20:15:39.184,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: Security domain: other
03/17-20:15:39.184,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: Saw unauthenticatedIdentity=nobody
03/17-20:15:39.184,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: findResource: null
03/17-20:15:39.200,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: Properties file=file:/home/andrewv/prj/jboss/server/nxa/conf/users.properties, defaults=null
03/17-20:15:39.201,DEBUG,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: Loaded properties, users=[myuser]
03/17-20:15:39.202,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: findResource: null
03/17-20:15:39.211,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: Properties file=file:/home/andrewv/prj/jboss/server/nxa/conf/roles.properties, defaults=null
03/17-20:15:39.212,DEBUG,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: Loaded properties, users=[myuser]
03/17-20:15:39.212,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: login
03/17-20:15:39.212,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: User 'myuser' authenticated, loginOk=true
03/17-20:15:39.218,TRACE,read-147.76.48.139-0: org.jboss.security.ClientLoginModule : Security domain: other
03/17-20:15:39.219,TRACE,read-147.76.48.139-0: org.jboss.security.ClientLoginModule : Enabling multi-threaded mode
03/17-20:15:39.227,TRACE,read-147.76.48.139-0: org.jboss.security.ClientLoginModule : Enabling restore-login-identity mode
03/17-20:15:39.227,TRACE,read-147.76.48.139-0: org.jboss.security.ClientLoginModule : Begin login
03/17-20:15:39.227,TRACE,read-147.76.48.139-0: org.jboss.security.ClientLoginModule : Obtained login: myuser, credential.class: [C
03/17-20:15:39.227,TRACE,read-147.76.48.139-0: org.jboss.security.ClientLoginModule : End login
03/17-20:15:39.228,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: commit, loginOk=true
03/17-20:15:39.228,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: Checking user: myuser, roles string: myrole
03/17-20:15:39.228,TRACE,read-147.76.48.139-0: .security.auth.spi.UsersRolesLoginModule: Adding to Roles: myrole
03/17-20:15:39.229,TRACE,read-147.76.48.139-0: org.jboss.security.ClientLoginModule : commit, subject=Subject:
Principal: myuser
Principal: Roles(members:myrole)
03/17-20:15:39.232,TRACE,read-147.76.48.139-0: org.jboss.security.SecurityAssociation : pushSubjectContext, subject=Subject:
Principal: myuser
Principal: Roles(members:myrole)
, sc=org.jboss.security.SecurityAssociation$SubjectContext@11e88fb{principal=myuser,subject=28521218}
03/17-20:15:39.232,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: defaultLogin, lc=javax.security.auth.login.LoginContext@1d9e3d9, subject=Subject(28521218).principals=org.jboss.security.SimplePrincipal@26810747(myuser)org.jboss.security.SimpleGroup@9757812(Roles(members:myrole))
03/17-20:15:39.233,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: updateCache, inputSubject=Subject(28521218).principals=org.jboss.security.SimplePrincipal@26810747(myuser)org.jboss.security.SimpleGroup@9757812(Roles(members:myrole)), cacheSubject=Subject(33406869).principals=org.jboss.security.SimplePrincipal@26810747(myuser)org.jboss.security.SimpleGroup@9757812(Roles(members:myrole))
03/17-20:15:39.233,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: Inserted cache info: org.jboss.security.plugins.JaasSecurityManager$DomainInfo@2d09aa[Subject(33406869).principals=org.jboss.security.SimplePrincipal@26810747(myuser)org.jboss.security.SimpleGroup@9757812(Roles(members:myrole)),credential.class=[C@15789782,expirationTime=1205747113218]
03/17-20:15:39.233,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: End isValid, true
03/17-20:15:39.233,TRACE,read-147.76.48.139-0: org.jboss.security.SecurityAssociation : pushSubjectContext, subject=Subject:
Principal: myuser
Principal: Roles(members:myrole)
, sc=org.jboss.security.SecurityAssociation$SubjectContext@d59df1{principal=myuser,subject=7627699}
03/17-20:15:39.237,DEBUG,read-147.76.48.139-0: PersistenceContextPropagationInterceptor: ++++ LongLivedSessionPropagationInterceptor
03/17-20:15:39.239,TRACE,read-147.76.48.139-0: org.jboss.security.SecurityAssociation : getPrincipal, principal=myuser
03/17-20:15:39.239,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: Begin isValid, principal:myuser, cache info: org.jboss.security.plugins.JaasSecurityManager$DomainInfo@2d09aa[Subject(33406869).principals=org.jboss.security.SimplePrincipal@26810747(myuser)org.jboss.security.SimpleGroup@9757812(Roles(members:myrole)),credential.class=[C@15789782,expirationTime=1205747113218]
03/17-20:15:39.248,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: Begin validateCache, info=org.jboss.security.plugins.JaasSecurityManager$DomainInfo@2d09aa[Subject(33406869).principals=org.jboss.security.SimplePrincipal@26810747(myuser)org.jboss.security.SimpleGroup@9757812(Roles(members:myrole)),credential.class=[C@15789782,expirationTime=1205747113218];credential.class=[C@15789782
03/17-20:15:39.248,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: End validateCache, isValid=true
03/17-20:15:39.248,TRACE,read-147.76.48.139-0: curity.plugins.JaasSecurityManager.other: End isValid, true
03/17-20:15:39.248,TRACE,read-147.76.48.139-0: org.jboss.security.SecurityAssociation : pushSubjectContext, subject=Subject:
Principal: myuser
Principal: Roles(members:myrole)
, sc=org.jboss.security.SecurityAssociation$SubjectContext@1ef7b50{principal=myuser,subject=25756366}
03/17-20:15:39.248,DEBUG,read-147.76.48.139-0: PersistenceContextPropagationInterceptor: ++++ LongLivedSessionPropagationInterceptor
03/17-20:15:39.249,INFO ,read-147.76.48.139-0: server.alarm.ejb.AlarmHistoryServiceBean: AlarmHistoryServiceBean.initiateAlarmHistoryQuery:
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137298#4137298
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137298
18 years, 1 month
[EJB 3.0] - a request over 3 entitybeans
by Ceene
Hello all
I have a question about EJB 3.0. It is possible to make a request over 3 tables? In my book they say that it is but i have no idea how i get the result.
I have already make the Beans and the ejb-ql-statement.
the request looks like this
| @NamedQueries({
| @NamedQuery(name="LOV_User.findByName",
| query="SELECT l FROM LOV_User l WHERE l.lov_usr_user = :name AND l.lov_usr_status_sign = 'A'"),
| @NamedQuery(name="LOV_User.test",
| query="SELECT l, b, s FROM LOV_User l, LOV_User_Right b, LOV_Right_Typ s " +
| "WHERE l.lov_usr_user = b.lov_urt_user " +
| "AND b.lov_urt_right_rule_sign = s.lov_rt_right_rule_sign " +
| "AND l.lov_usr_status_sign = 'A' " +
| "AND b.lov_urt_status_sign = 'A' " +
| "AND l.lov_usr_user = :name")
| })
|
If i deploy the Bean JBoss throw no error thats the reason i think that this must work. But in my Client i have no idea how i get the resultcolumns that include the other entityBeans.
Can somebody help me?
(Sorry for the bad english)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137288#4137288
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137288
18 years, 1 month
[JBoss Messaging] - Re: problems connecting to a Queue
by FrankTheTank
Are you even using any AOP stuff?
Check your project settings. In eclipse the AOP stuff in the Context-Menu is dangerously close to other much needed functions and maybe you just hit the wrong one, as I have often done.
Can you see the queue 'queue/tnb/inbound' in the JNDI viewer?
Also and might not even really be a problem but I use this code:
| ctx = new InitialContext();
| Queue queue = (Queue) ctx.lookup("queue/MyQueue");
| QueueConnectionFactory factory = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");
| QueueConnection connection = factory.createQueueConnection();
| QueueSession session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
|
I got it from somewhere else and it works.
Maybe the order is important or something.
Also the access code you have written uses those props that are only needed on the client side.
That might be a reason why it is not working. (really guessing here)
Remove the props from the new InitialContext() and try it.
HTH
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137287#4137287
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137287
18 years, 1 month