[J2EE Design Patterns] - Service EJB to DAO EJB Design Issues
by mattmcgrillis
I'm stumped...
I have a JSF which calls a serviceEJB which in turn calls a daoEJB. Now when serviceEJB calls getUserPrinciple it returns the principle correctly. serviceEJB then calls methodA of daoEJB with a @RunAs set to âSERVICEâ (to stop the JSF web client being able to call daoEJB directly - with RolesAllowed set on the DAO). Though when I call getUserPrinciple within daoEJB gets a caller principle on âanonymousâ instead of the correct principle set by JAAS.
Now you can use @RunAsPrincipal... to manually set the principal when the dao EJB is delared... but as far as I can see, there's no way of passing in the original principal
Surely there's a hole in the spec if this anyone using a Service-DAO ejb pattern can't use caller principle in the DAO?
I can't be the first to of hit this type of problem, whereby I need to use 'run as' to change the ROLE in the service so the DAO can't be called directly(by using RolesAllowed)...
I just don't understand why it is acceptable to change the Principle? Surely it should be fine to let that be set by JAAS and maintained, and just the role changed by 'run as' rather than changing the role (as expected) but also deleting the principle?
Does anyone know if there is another way round getting the DAOs not be called by the webclient without using RunAs?
I could remove the RunAs though this screws up my security model as in theory my JSF beans could call my dao EJBs directly (which I don't want)
Or ideally... does anyone know of any way of retaining the orignal principal set by jaas when an ejb calls another ejb when @RunAs is being set???
Thanks
Matt
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216481#4216481
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216481
15 years, 10 months
[Installation, Configuration & DEPLOYMENT] - JBOSS JBPM configuration error with mssql 2005
by srufus
Hi all,
I m trying to set JBOSS JBPM configuration on jboss-soa-p.4.3.0.
Im using MSSQL 2005 as DB. I configured Data source in jbpm-ds.xml.Some 32 jbpm tables are created in DB.
I face following error during server start up, not sure ..what could be problem.Thanks for any help...
error stack:
=======
2009-03-10 14:44:29,417 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 102, SQLState: S0001
2009-03-10 14:44:29,417 ERROR [org.hibernate.util.JDBCExceptionReporter] Incorrect syntax near '@P0'.
2009-03-10 14:44:29,417 ERROR [org.jbpm.db.JobSession] org.hibernate.exception.SQLGrammarException: could not execute query
2009-03-10 14:44:29,417 ERROR [org.jbpm.job.executor.JobExecutorThread] exception in job executor thread. waiting 5000 milliseconds
org.jbpm.JbpmException: couldn't get acquirable jobs
at org.jbpm.db.JobSession.getFirstAcquirableJob(JobSession.java:44)
at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:114)
at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:58)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
at org.jbpm.db.JobSession.getFirstAcquirableJob(JobSession.java:40)
... 2 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '@P0'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:255)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:187)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 11 more
2009-03-10 14:44:35,901 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 102, SQLState: S0001
2009-03-10 14:44:35,901 ERROR [org.hibernate.util.JDBCExceptionReporter] Incorrect syntax near '@P0'.
2009-03-10 14:44:35,901 ERROR [org.jbpm.db.JobSession] org.hibernate.exception.SQLGrammarException: could not execute query
2009-03-10 14:44:35,901 ERROR [org.jbpm.job.executor.JobExecutorThread] exception in job executor thread. waiting 10000 milliseconds
org.jbpm.JbpmException: couldn't get acquirable jobs
at org.jbpm.db.JobSession.getFirstAcquirableJob(JobSession.java:44)
at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:114)
at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:58)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
at org.jbpm.db.JobSession.getFirstAcquirableJob(JobSession.java:40)
... 2 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '@P0'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:255)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:187)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 11 more
thanks,
vasu
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216478#4216478
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216478
15 years, 10 months