[JBoss Portal] - Re: invalidate cache / user per user and window per window
by julien@jboss.com
Hello Antoine,
it cannot really be done right now as cached content is stored in the HTTP session of the user (which makes sense since it has the same lifecycle than the user).
The code is located in org.jboss.portal.portlet.aspect.cache.ConsumerCacheInterceptor. Here the content of the cache is retrieved/stored in the PRINCIPAL_SCOPE context.
This context is the (http session + the principal id) : the http session for the lifecycle management and the principal id for security reasons (so a user does not see the cached content from another user which can happens on logout operations when the session cookie stays the same).
So basically you can modify this interceptor to store instead the content in a shared cache and have that shared cache expose operation through JMX. This interceptor is declared in jboss-portal.sar/META-INF/jboss-service.xml and at this place you can replace the default implementation by your.
For the cache you could use JBoss Cache has a field of your interceptor and expose invalidation methods on the interceptor itself as it is already an MBean.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009056#4009056
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009056
17 years, 10 months
[Tomcat, HTTPD, Servlets & JSP] - Re: JSPs shown as text in Firefox (Content-Type: text/plain)
by erikdhansen
Not sure why you would have to set that manually, if the page already has the contentType attribute set in the page directive.
What I've noticed is that the JSPs that fail to render properly have only:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
in them with respect to content type and character encoding. The files that DO render correctly, have the same:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
as well as:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
in the source of the page.
In the case where the page has the <meta http=equiv tag, the response is received at mod_jk with the correct HTTP headers and the meta tag removed from the page (by JBoss/Tomcat?) and the page is rendered correctly.
In the case where the page only has the JSP page directive for contentType, there is no HTTP header for Content-Type seen (by mod_jk) and is, apparently, tagged with the default Content-Type when a header is not found -- text/plain -- presumably by Apache on the way out.
A) Why is the JSP directive not sufficient to generate the HTTP Content-Type header or who is dropping/ignoring/losing it?
B) Isn't including the meta http-equiv tag in addition to setting the content type in the JSP redundant?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009053#4009053
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009053
17 years, 10 months
[JBoss Seam] - Re: How to use si:selectItems with an object that has a Stri
by lawrieg
I stepped through the code and you are quite right that the first CampaignType object passed to BasicEntityConverter's getIdAsString method has null values in its fields.
If I modify the BasicEntityConverter code to not throw an exception, then I see that on the second and third calls to the getIdAsString method, the entity argument contains the CampaignType objects I would expect.
customerTypes.resultList is populated by a Seam Application Framework Entity-Query:
<framework:entity-query name="customerTypes" ejbql="select customerType from CustomerType customerType" />
|
I've checked that my entity-query only returns two CustomerType objects which have non-null id values.
My si:selectItems tag is as follows:
<h:selectOneMenu value="#{customerHome.instance.customerType}" id="customerType">
| <si:selectItems value="#{customerTypes.resultList}" var="customerType" label="#{customerType.name}" noSelectionLabel="Please Select..." />
| </h:selectOneMenu>
So now I'm more than a bit confused as to how a CustomerType with a null id value is being passed to BasicEntityConverter's getIdAsString method.
Does the object from the <h:selectOneMenu> value property get passed to the BasicEntityConverter??? The reason I ask is because I'm creating a new Customer and therefore #{customerHome.instance.customerType} would initially contain a new instance of CustomerType. If so, how do you work around this?
Any help would be very much appreciated as I'm starting to tear my hair out...
Cheers,
Lawrie
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009047#4009047
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009047
17 years, 10 months
[Persistence, JBoss/CMP, Hibernate, Database] - Calling One Session From Another And Getting LazyInitializat
by tlien
I am passing an entity with a lazy loaded property from one session bean to another sessionbean and getting a LazyInitializationException. It's still inside of jboss so I don't understand why it can't load it. Is this expected behavior? If so, what is the correct way to do it. Heres a simple example of what I am talking about.
@Entity
@Table(name = "LazyChild")
public class LazyChild implements java.io.Serializable {
private Integer key;
private String name;
@Id @GeneratedValue
@Column(name="LazyChildKey")
public Integer getKey() { return key; }
public void setKey(Integer key) { this.key = key; }
public String getName() { return name; }
public void setName(String s) { name = s; }
}
@Entity
@Table(name = "Test")
public class TestEntity implements java.io.Serializable {
private Integer key;
private LazyChild lazyChild;
@Id @GeneratedValue
@Column(name="TestKey")
public Integer getKey() { return key; }
public void setKey(Integer key) { this.key = key; }
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "LazyChildKey")
public LazyChild getLazyChild() { return lazyChild; }
public void setLazyChild(LazyChild l) { lazyChild = l; }
}
@Stateless
@RemoteBinding (jndiBinding="TestSessionHelper")
@Remote(TestSessionHelper.class)
public class TestSessionHelperBean {
@PersistenceContext
protected EntityManager em;
public void useLazyChild(TestEntity entity) {
entity.getLazyChild().getName();
}
}
@Stateless
@RemoteBinding (jndiBinding="TestSession")
@Remote(TestSession.class)
public class TestSessionBean {
@PersistenceContext
protected EntityManager em;
@EJB TestSessionHelper m_sessionHelper;
public void doIt() {
TestEntity entity = em.find(TestEntity.class, 1);
m_sessionHelper.useLazyChild(entity);
}
}
public class ClientSideTest {
public static void main(String[] args) throws Exception {
InitialContext ctx = new InitialContext();
TestSession session = (TestSession)ctx.lookup("TestSession");
session.doIt();
}
}
When I deploy these session beans and run ClientSideTest.main I get the following exception on the server side.
15:28:52,109 ERROR [LazyInitializationException] could not initialize proxy - no
Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Sessi
on
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyIn
itializer.java:57)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(Abstrac
tLazyInitializer.java:111)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLa
zyInitializer.java:160)
at alliancetechnical.ejb3.session.LazyChild$$EnhancerByCGLIB$$6f310ca4.g
etName()
at alliancetechnical.ejb3.session.TestSessionHelperBean.useLazyChild(Tes
tSessionHelperBean.java:14)
...
at $Proxy670.useLazyChild(Unknown Source)
at alliancetechnical.ejb3.session.TestSessionBean.doIt(TestSessionBean.j
ava:19)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009039#4009039
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009039
17 years, 10 months
[JBoss Seam] - Re: Transaction problem after upgrade
by juangiovanolli
exactly, my problem is this:
| javax.faces.el.EvaluationException: Cannot get value for expression '#{org.jboss.seam.core.jbpmContext}'
| at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:402)
| at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:53)
| at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1672)
| at org.jboss.seam.Component.getInstance(Component.java:1621)
| at org.jboss.seam.Component.getInstance(Component.java:1598)
| at org.jboss.seam.Component.getInstanceToInject(Component.java:1848)
| at org.jboss.seam.Component.injectFields(Component.java:1348)
| at org.jboss.seam.Component.inject(Component.java:1118)
| at org.jboss.seam.interceptors.BijectionInterceptor.bijectNonreentrantComponent(BijectionInterceptor.java:76)
| at org.jboss.seam.interceptors.BijectionInterceptor.bijectComponent(BijectionInterceptor.java:58)
| at sun.reflect.GeneratedMethodAccessor162.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:36)
| 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.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
| at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:29)
| at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:52)
| at sun.reflect.GeneratedMethodAccessor158.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:51)
| at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:28)
| at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
| at org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:23)
| at sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
| at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:39)
| at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
| at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:145)
| at org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:80)
| at com.santex.darwin.example.WorkflowActivityHomeExample$$EnhancerByCGLIB$$de63b30b.clearDirty(<generated>)
| at org.jboss.seam.contexts.Lifecycle.isAttributeDirty(Lifecycle.java:489)
| at org.jboss.seam.contexts.ServerConversationContext.flush(ServerConversationContext.java:217)
| at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:387)
| at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:288)
| at org.jboss.seam.jsf.AbstractSeamPhaseListener.afterRender(AbstractSeamPhaseListener.java:233)
| at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:95)
| at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:92)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
| 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:75)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
| 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.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(Http11BaseProtocol.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: javax.faces.el.EvaluationException: Exception getting value of property jbpmContext of base of type : org.jboss.seam.Namespace
| at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:96)
| at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:532)
| at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
| at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
| ... 124 more
| Caused by: java.lang.IllegalStateException: JbpmContext may only be used inside a transaction
| at org.jboss.seam.core.ManagedJbpmContext.getJbpmContext(ManagedJbpmContext.java:75)
| 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.seam.util.Reflections.invoke(Reflections.java:18)
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:102)
| at org.jboss.seam.Component.callComponentMethod(Component.java:1797)
| at org.jboss.seam.Component.unwrap(Component.java:1823)
| at org.jboss.seam.Component.getInstance(Component.java:1645)
| at org.jboss.seam.Component.getInstance(Component.java:1598)
| at org.jboss.seam.Namespace.get(Namespace.java:42)
| at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:78)
| ... 127 more
|
|
ANY IDEAS ???
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009037#4009037
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009037
17 years, 10 months