[JBoss Seam] - desing pattern for remote accessing
by mateusz.mrozewski
Hello,
I am looking for correct design pattern which will allow me to access data via EJB remotly. I want to have a single point of enterance both for SEAM application and for other applications, which use the same data.
My current idea is to have:
- Stateless EJB acting as a DAO
- Stateful EJB, acting as a seam action
- JSF as a presentation layer
The stateful EJB calls the stateless to get the data. It also additionally has a remote interface which allows other application to call it. Due to convetions of seam I have to "double" the interface, for example:
| @DataModel
| private List<Contact> contacts;
|
| @DataModelSelection
| private Contact contact;
|
| @Factory("contacts")
| public void findAll() {
| if(contacts == null) {
| contacts = myStatelessBean.findAll();
| }
| }
|
| public List<Contact> getContacts() {
| findAll();
| return contacts;
| }
|
I find this sollution quite innatural, because you have to implement two interfaces, which do quite the same thing. The other idea is to develop a facade, but it introduces another problem: passing parameters and returning values - it is done by @In and @Out annotations in seam. You will have to call additional methods from facade to set parameters and get the returning values.
Which sollution is better? Maybe you know a better sollution for this problem?
thx
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049184#4049184
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049184
18 years, 10 months
[JBossCache] - Treecache / JBoss Cache Issue
by cwiesing
Hello,
I have a problem with the treecache configuration. First of all I?m my application runs under the following versions:
JBoss 4.0.5 GA
JBoss Seam 1.2.1 GA
JBoss Cache 1.4.0 SP1
Hibernate 3.2.0 GA
The treecache.xml is looking like this:
|
| <?xml version="1.0" encoding="UTF-8" ?>
| <server>
| <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar" />
|
| <mbean code="org.jboss.cache.TreeCache" name="jboss.cache:service=TreeCache">
| <depends>jboss:service=Naming</depends>
| <depends>jboss:service=TransactionManager</depends>
|
| <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
| <attribute name="NodeLockingScheme">PESSIMISTIC</attribute>
| <attribute name="IsolationLevel">NONE</attribute>
|
| <attribute name="CacheMode">LOCAL</attribute>
|
| <attribute name="UseInterceptorMbeans">false</attribute>
|
| <attribute name="LockAcquisitionTimeout">15000</attribute>
|
| <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
|
| <attribute name="EvictionPolicyConfig">
| <config>
| <attribute name="wakeUpIntervalSeconds">5</attribute>
| <region name="/_default_">
| <attribute name="maxNodes">10000</attribute>
| <attribute name="timeToLiveSeconds">3600</attribute>
| <attribute name="maxAgeSeconds">86400</attribute>
| </region>
| <region name="/net/package/xxx">
| <attribute name="maxNodes">5000</attribute>
| <attribute name="timeToLiveSeconds">30</attribute>
| </region>
| </config>
| </attribute>
|
| <attribute name="CacheLoaderConfiguration">
| <config>
| <passivation>false</passivation>
| <shared>false</shared>
|
| <cacheloader>
| <class>org.jboss.cache.loader.FileCacheLoader</class>
| <properties>
| location=treecache
| </properties>
| <async>false</async>
| <fetchPersistentState>true</fetchPersistentState>
| <ignoreModifications>false</ignoreModifications>
|
| <purgeOnStartup>true</purgeOnStartup>
| </cacheloader>
| </config>
| </attribute>
| </mbean>
| </server>
|
I?m using the EntityManager with ExtendedPersistenceContext. So when I try an update of a dataset the following Exception is thrown:
anonymous wrote :
| [17:26:07] [Administrator] [INFO ] [...STDOUT :152 ] >> Hibernate: update SCHEMA.CONTRACT set description=? where id=?
| [17:26:07] [Administrator] [WARN ] [...che.interceptors.TxInterceptor:104 ] >> Commit failed. Clearing stale locks.
| [17:26:07] [Administrator] [ERROR] [....OrderedSynchronizationHandler:119 ] >> failed calling afterCompletion() on TxInterceptor.LocalSynchronizationHandler(gtx=GlobalTransaction
| ::5, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=urraco/25, BranchQual=, localId=25])
| java.lang.RuntimeException: Commit failed.
| at org.jboss.cache.interceptors.TxInterceptor.runCommitPhase(TxInterceptor.java:716)
| at org.jboss.cache.interceptors.TxInterceptor$RemoteSynchronizationHandler.afterCompletion(TxInterc
| eptor.java:1007)
| at org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.afterCompletion(TxInterce
| ptor.java:1103)
| at org.jboss.cache.interceptors.OrderedSynchronizationHandler.afterCompletion(OrderedSynchronizatio
| nHandler.java:83)
| at org.jboss.tm.TransactionImpl.doAfterCompletion(TransactionImpl.java:1526)
| at org.jboss.tm.TransactionImpl.completeTransaction(TransactionImpl.java:1198)
| at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:377)
| at org.jboss.tm.TxManager.commit(TxManager.java:240)
| at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.ja
| va:140)
| at org.jboss.seam.jsf.AbstractSeamPhaseListener.commitOrRollback(AbstractSeamPhaseListener.java:324
| )
| at org.jboss.seam.jsf.TransactionalSeamPhaseListener.handleTransactionsAfterPhase(TransactionalSeam
| PhaseListener.java:45)
| at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:111)
| at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager
| .java:89)
| at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:345)
| at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252
| )
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at net.tmobile.trp.security.AuthorizationFilter.doFilter(AuthorizationFilter.java:89)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202
| )
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202
| )
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202
| )
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202
| )
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202
| )
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
|
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11Base
| Protocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: java.lang.Exception: transaction GlobalTransaction::5 not found in transaction table
| at org.jboss.cache.loader.FileCacheLoader.commit(FileCacheLoader.java:220)
| at org.jboss.cache.interceptors.CacheStoreInterceptor.invoke(CacheStoreInterceptor.java:95)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.CacheLoaderInterceptor.invoke(CacheLoaderInterceptor.java:197)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.TxInterceptor.handleCommitRollback(TxInterceptor.java:660)
| at org.jboss.cache.interceptors.TxInterceptor.runCommitPhase(TxInterceptor.java:702)
| ... 57 more
|
I tried to debug the source code and it seams like that the prepare-Method of the JBoss-Cache is never called before the commit-Method (which includes the remove-Statement) was called.
But when I remove the CacheLoaderConfiguration part from my treecache-configuration it seams to be working.
Which reason can caused this Exception?
Thanks in advance
Christian
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049181#4049181
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049181
18 years, 10 months
[JBoss Seam] - Character encoding
by nevermoreagain
Hello, i found this in Seam Reference
anonymous wrote :
| Character encoding
| Sets the character encoding of submitted form data.
| This filter is not installed by default and requires an entry in components.xml to enable it:
| <web:character-encoding-filter encoding="UTF-16"
| override-client="true"
| url-pattern="*.seam"/>
|
| ? encoding ? The encoding to use.
| ? override-client ? If this is set to true, the request encoding will be set to whatever is specified by encoding
| no matter whether the request already specifies an encoding or not. If set to false, the request encoding
| will only be set if the request doesn't already specify an encoding. The default setting is false.
| ? url-pattern ? Used to specify which requests are filtered, the default is all requests.
But i'm wondering why this is not working for me?
I found that after re-rendering cyrillic text data in <h:inputText> become unreadable.
I'm using JBoss AS 4.0.5 and Seam 1.2.1
Does anyone know how to solve this problem ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049176#4049176
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049176
18 years, 10 months
[Security & JAAS/JBoss] - Runas identity for a jsp/servlet does not work
by illipilla
Hi
I have been trouble shooting an issue where in I could not get Runas principal work for a jsp that is marked with run-as tag. Looks like the http://jira.jboss.com/jira/browse/JBAS-1297 has fixed part of my issue. But it still does not work.
Below are my web.xml snippets (adding only required parts)
<servlet-name>SecureJSP</servlet-name>
<jsp-file>/secure/indexsecure.jsp</jsp-file>
<run-as>
<role-name>WebRunAsRole</role-name>
</run-as>
.....................
<security-role>
<role-name>WebRunAsRole</role-name>
</security-role>
Below are my jboss-web.xml snippets
<security-role>
<role-name>WebRunAsRole</role-name>
<principal-name>b2uset</principal-name>
</security-role>
<servlet-name>SecureJSP</servlet-name>
<run-as-principal>b2uset</run-as-principal>
After addding above in my descriptors with debugging on I could see when the application gets deployed it uses the role as well as princpal. Below are my log entries.
2007-05-28 17:50:31,055 TRACE [org.jboss.web.tomcat.security.RunAsListener] SecureJSP, runAs: [roles=[WebRunAsRole],principal=b2uset]
2007-05-28 17:50:31,055 TRACE [org.jboss.security.SecurityAssociation] popRunAsIdentity, runAs=[roles=[WebRunAsRole],principal=b2uset]
Although everything looks good so far, I could not get this jsp running under the principal "b2uset" when the jsp is accessed. My request.getUserPrincipal, Request.getRemoteUser, SecurityAssociation.getSubject all seem to be showing either null or any existing context of already authenticated user but not the prinipal of run-as user "b2uset". With EJB things may be working but I have not tried. I am currently trying with jsp.
Any thoughts?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049173#4049173
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049173
18 years, 10 months