[EJB] - CMR Collections and transaction demarcation
by smith.gerry@gmail.com
I am using JBoss 4.2.1, EJB 2.1.
I have a session bean which uses a finder to get a collection of entities and creates a list of data transfer objects. The entities have CMR Collections that need to be accessed.
I am trying to make this work without a transaction, and I'm using XDoclet, so I've used @ejb.transaction type="NotSupported" for the session bean, and @ejb.transaction type="Supports" for the entity beans - the one with finder and also the ones in the CMR Collections.
I'm getting this exception:
java.lang.IllegalStateException: A CMR collection may only be used within the transction in which it was created
Does this mean that you have to be in a transaction when you access a CMR transaction, or am I doing something wrong ?
(The session bean is called by another session bean which has the default 'required' transaction type, in case that makes a difference).
Would this happen in Jboss 5 as well ?
Many thanks,
Gerry
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4260286#4260286
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4260286
16 years, 8 months
[Security] - Re: Caller unauthorized on using a ejb3 statetlesssessionbea
by praenti
ok. WebAuthentication is working. I had to create the jboss-web.xml and added there the security-domain. Now my Login module is running.
But the original error is still present. Using a Servlet which does WebAuthentication.
The error:
| 13:59:50,370 INFO [SpiiderLoginModule] LdapLoginModule, dsJndiName=cancardviewe
| rDS
| 13:59:50,370 INFO [SpiiderLoginModule] rolesQuery=SELECT u.userid, r."role" FRO
| M "security".application_user u, "security".application_role r, "security".user_
| role ur WHERE u.userid = ? AND u.userid = ur.user_id AND ur.role_id = r."role"
| 13:59:50,370 INFO [SpiiderLoginModule] defaultRole=RegularUser
| 13:59:50,370 INFO [SpiiderLoginModule] trying dn: uid=extern.michael.obster, ou
| =xxx,ou=People,ou=Access
| 13:59:50,370 INFO [SpiiderLoginModule] Logging into LDAP server, env={java.nami
| ng.factory.initial=com.sun.jndi.ldap.LdapCtxFactory, dsJndiName=cancardviewerDS,
| rolesQuery=SELECT u.userid, r."role" FROM "security".application_user u, "secur
| ity".application_role r, "security".user_role ur WHERE u.userid = ? AND u.userid
| = ur.user_id AND ur.role_id = r."role", java.naming.security.principal=uid=exte
| rn.michael.obster, ou=xxx,ou=People,ou=Access, jboss.security.security_domai
| n=cancardDomain, java.naming.provider.url=ldap://xxxxxxx, java.namin
| g.security.authentication=simple, java.naming.security.credentials=***, principa
| l.dn.groups=ou=xxxxxx
| ,ou=People,ou=Access:ou=External,ou=People,ou=Access}
| 13:59:50,401 INFO [SpiiderLoginModule] Failed to log into LDAP server. [LDAP: e
| rror code 32 - No Such Object]
| 13:59:50,401 INFO [SpiiderLoginModule] trying dn: uid=extern.michael.obster, ou
| =External,ou=People,ou=Access
| 13:59:50,401 INFO [SpiiderLoginModule] Logging into LDAP server, env={java.nami
| ng.factory.initial=com.sun.jndi.ldap.LdapCtxFactory, dsJndiName=cancardviewerDS,
| rolesQuery=SELECT u.userid, r."role" FROM "security".application_user u, "secur
| ity".application_role r, "security".user_role ur WHERE u.userid = ? AND u.userid
| = ur.user_id AND ur.role_id = r."role", java.naming.security.principal=uid=exte
| rn.michael.obster, ou=External,ou=People,ou=Access, jboss.security.security_doma
| in=cancardDomain, java.naming.provider.url=ldap://xxxxxxxx, java.nami
| ng.security.authentication=simple, java.naming.security.credentials=***, princip
| al.dn.groups=ou=xxxxxx
| ,ou=People,ou=Access:ou=External,ou=People,ou=Access}
| 13:59:50,417 INFO [SpiiderLoginModule] Logged into LDAP server, javax.naming.ld
| ap.InitialLdapContext@1a21699
| 13:59:50,480 INFO [SpiiderLoginModule] getRoleSets using rolesQuery: SELECT u.u
| serid, r."role" FROM "security".application_user u, "security".application_role
| r, "security".user_role ur WHERE u.userid = ? AND u.userid = ur.user_id AND ur.r
| ole_id = r."role", gid: 99A44E672EA8C49B
| 13:59:50,511 DEBUG [SpiiderLoginModule] Principal: AdminUser
| 13:59:50,542 INFO [LoginServlet] Login sucessfull
| 13:59:51,011 ERROR [[LoginServlet]] Servlet.service() for servlet LoginServlet t
| hrew exception
| javax.ejb.EJBAccessException: Caller unauthorized
| at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(Ro
| leBasedAuthorizationInterceptorv2.java:199)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
| java:102)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3Au
| thenticationInterceptorv2.java:186)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
| java:102)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterce
| ptor.java:41)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
| java:102)
| at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContaine
| rShutdownInterceptor.java:67)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
| java:102)
| at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invo
| ke(CurrentInvocationInterceptor.java:67)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
| java:102)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessCo
| ntainer.java:421)
| at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterce
| ptor.java:85)
| at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
| java:72)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
| java:102)
| at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
| at $Proxy344.invoke(Unknown Source)
| at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandl
| erBase.invoke(SessionProxyInvocationHandlerBase.java:207)
| at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandl
| erBase.invoke(SessionProxyInvocationHandlerBase.java:164)
| at $Proxy343.getAllRoles(Unknown Source)
| at vwg.audi.cancard.webservlet.LoginServlet.serveRequest(LoginServlet.ja
| va:61)
| at vwg.audi.cancard.webservlet.LoginServlet.doGet(LoginServlet.java:29)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
| icationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
| ilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
| lter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
| icationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
| ilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
| alve.java:235)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
| alve.java:191)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
| yAssociationValve.java:190)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
| e.java:92)
| at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.proce
| ss(SecurityContextEstablishmentValve.java:126)
| at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invok
| e(SecurityContextEstablishmentValve.java:70)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
| ava:127)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
| ava:102)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
| onnectionValve.java:158)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
| ve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
| a:330)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
| :829)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
| ss(Http11Protocol.java:598)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
| 7)
| at java.lang.Thread.run(Thread.java:619)
|
The used servlet LoginServlet:
| package vwg.audi.cancard.webservlet;
|
| import java.io.IOException;
|
| import javax.ejb.EJBAccessException;
| import javax.servlet.ServletException;
| import javax.servlet.http.HttpServlet;
| import javax.servlet.http.HttpServletRequest;
| import javax.servlet.http.HttpServletResponse;
|
| import org.apache.log4j.Logger;
| import org.jboss.web.tomcat.security.login.WebAuthentication;
|
| public class LoginServlet extends HttpServlet
| {
| private Logger log = Logger.getLogger(LoginServlet.class);
|
| /**
| *
| */
| private static final long serialVersionUID = -5539909157863711284L;
|
| /**
| * Process the HTTP Get request
| */
| public void doGet(HttpServletRequest request, HttpServletResponse response)
| throws ServletException, IOException
| {
| serveRequest(request, response);
| }
|
| /**
| * Process the HTTP Post request
| */
| public void doPost(HttpServletRequest request, HttpServletResponse response)
| throws ServletException, IOException
| {
| serveRequest(request, response);
| } // doPost
|
| /**
| * In dieser Methode findet die eigentliche Verarbeitung des
| * HTTPServletRequests statt. Sie wird von den beiden public Methoden doPost
| * und doGet aufgerufen.
| */
| public void serveRequest(HttpServletRequest request,
| HttpServletResponse response) throws ServletException, IOException
| {
| String username = "extern.michael.obster";
| String pass = "myPassword";
| WebAuthentication webAuthentication = new WebAuthentication();
|
| if (webAuthentication.login(username, pass)) {
| log.info("Login sucessfull");
| }
| else {
| log.info("Login failed");
| }
|
| try {
| ServiceLocator.getInstance().getUserService().getAllRoles();
| } catch (ServiceLocatorException e) {
| e.printStackTrace();
| }
|
| webAuthentication.logout();
|
|
| }
|
|
|
| }
|
Any idea what the problem is?
Best regards,
Michael
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4260283#4260283
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4260283
16 years, 8 months
[JCA] - Re: Oracle Failover connection url
by born_free_77
Hey Vickyk,
Thanks for the response. I am using the same xml files and I did see the test-ha-ds.xml files.
Initially I was using <connection-url> like this
| <connection-url>jdbc:oracle:thin@xxxxx:1521@sid|jdbc:oracle:thin@xxxxx:1521@sid</connection-url>
|
if I use
| <connection-url>jdbc:oracle:thin:@(description=(address_list=(load_balance=on)(failover=on)(address=(protocol=tcp)(h
| ost=xxxxhost1)(port=1521))(address=(protocol=tcp)(host=xxxxhost2)(port=1521)))(connect_data=(service
| _name=xxxxsid)(failover_mode=(type=select)(method=basic))))</connection-url>
|
then jboss complains that url-delimiter is not povided. I did use the same url when using </local-tx-datasource> but this still does not gives me failover.
Whats the difference between <local-tx-datasource> and <ha-local-tx-datasource>?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4260280#4260280
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4260280
16 years, 8 months
[JBoss Portal Users] - Jboss Portal 2.7.2 and EJB3
by Fuchs
Hello,
I like to know, how to run EJB3 on the JBoss-Portal-2.7.2-bundle.
I tried to do it with the instructions of EJB3-Download.
| 1. Download EJB 3.0 RC4 - PFD.
| 2. Unzip this file.
| 3. Copy ejb3.deployer from the lib/ directory of the distribution to
| jboss-4.0.x/server/all/deploy
| 4. Copy ejb3-clustered-sfsbcache-service.xml from the lib/ directory
| of the distribution to jboss-4.0.x/server/all/deploy
| 5. Copy ejb3-entity-cache-service.xml from the lib/ directory
| of the distribution to jboss-4.0.x/server/all/deploy
| 6. Copy ejb3-interceptors-aop.xml from the lib/ directory
| of the distribution to jboss-4.0.x/server/all/deploy
| 7. Copy jboss-aop-jdk50.deployer from the lib/ directory
| of the distribution to jboss-4.0.x/server/all/deploy
| 8. Copy jboss-remoting.jar from the lib/ directory
| of the distribution to jboss-4.0.x/server/all/lib
| 9. Copy jboss-serialization.jar from the lib/ directory
| of the distribution to jboss-4.0.x/server/all/lib
| 10. Copy jboss-j2ee.jar from the lib/ directory of the distribution
| to jboss-4.0.x/server/all/lib
| 11. Remove ejb3-persistence.jar from jboss-4.0.x/server/all/lib
| 12. Remove hibernate3.jar from jboss-4.0.x/server/all/lib
| 13. Remove hibernate-annotations.jar from jboss-4.0.x/server/all/lib
| 14. Remove hibernate-entitymanager.jar from jboss-4.0.x/server/all/lib
| 15. Remove jboss-aop.deployer/ from jboss-4.0.x/server/all/deploy
| 16. Start jboss up with the all configuration run.sh -c all
|
| If you do not want to run with the all configuration, the skip the steps of copying the ejb3-clustered-sfsbcache-service.xml and the ejb3-entity-cache-service.xml
|
But with a bad result.
The most exceptions comes because the service is not installed.
One is shown here:
| ObjectName: jboss.ejb3:service=EJB3Deployer
| State: NOTYETINSTALLED
| Depends On Me:
| jboss.ws:service=DeployerInterceptorEJB3
|
Any Help will be welcome!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4260279#4260279
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4260279
16 years, 8 months