[JBoss Seam] - How to get Container properties
by knuwu
I have the following problem:
I like to store some of my application configuration parameters outside the ear-package. The reason for that is, that some configuration values will have different values for development, test and production enviroment.
Best would be to store these values in a configuration file in the config directory of the container (equally to *-ds.xml configuration).
First difficulty: Find out where the container is running and where to find the config directory.
Second difficulty: If there are more than one application running on the same container, you have to chose a unique file name for your config file for each application running on that container. So the application must know it's name.
Third difficulty: All above should even work, when you are testing your application with testng and you are running in an embedded ejb3 container.
I found a solution for the first two problems. I get the deployment path from the Deploy Scanner MBean and calculate the path of the server config relative to that path. I derive the application name from the Init.instance().getJndiPattern() value.
You may also get the path information from System.getProperty calls.
But all is not working, if you start testing with the embedded ejb3 conatiner. The embedded ejb container does neither have the appropriate MBeans nor are there system properties.
The only solution might be to set a special system property. Disadvantage of that solution: You have to make sure it will be set in all possible run configurations (testng plugin, testng ant call, jboss start with eclipse plugin, jboss start with command line).
Is there a better solution?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028322#4028322
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4028322
19Â years, 1Â month
[Management, JMX/JBoss] - Re: Class loader probelm
by azhurakousky
Try to realize, ot's not a JBoss problem. It is SUN problem that they allowed (after java 1.1) for same type classes not be be type safe if they are loaded by different clas loaders. Think about it; why should you be getting ClassCast exception on two classes with identical byte code?, but you will if class loaders are different.
JBoss Class Loading architecture attempting to override this rule where com.foo.Foo=com.foo.Foo if they are the same version by making sure that the class is loaded only once by a single class loader and is shared by many applications.
If you want to run appliations that are using different versions of the same packages, isolation could give you a way to do that, but you might also think about deploying such applications in different configurations of JBoss.
Just copy "default" or "all" rrename it and there you have another instance that can host anoher version of Foo
Regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028320#4028320
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4028320
19Â years, 1Â month
[Management, JMX/JBoss] - Re: Class loader probelm
by xaleyba
"azhurakousky" wrote : If you are using the same Spring versions, then your runtime of bothe WAR and SAR should use classes loaded by the same class loader, to avoid problems. There are several things you can do.
| 1) The obvious one is to do what you don't want to do (why?) and that is to copy Spring JARs in the lib directory of JBoss. This way WAR and SAR will be using classes loaded by the same class loader.
| 2) Since you don't want to copy to lib dir, and if I understand correctly your SAR and WAR have some type of reliance on one another, you can encapsulate your WAR inside of SAR.
| 3) You can also enable JBoss Class Loading model for the WAR. By default it is desabled and that is why you are having problems whenever you are dealing with the same classes (WAR/SAR). You probably getting ClassCast/Linkage and other errors simply becouse those classes are loaded by different class loaders. To do that:
| a) Remove your loader isolation for the SAR
| b) Go to JBOSS_HOME/server/<your_configuration>/deploy/jbossweb-tomcat55.sar\META-INF\jboss-service.xml and change the following attribute to "true"
|
| | <attribute name="UseJBossWebLoader">true</attribute>
| |
|
| Let me know
Thanks for your reply.
I don't want to have my spring jars in the main jboss server instance lib directory because there are many other applications (made by other people) and I found this mix terrible. Anybody could install another app with another spring version that can generate problems to my app or viceversa.
I found more clean to have my app´s isolated with their dependencies (except for those jar that come with JBoss by defualt.
I can't use option 2 because tomcat service is used by other apps´.
I'll try option 3 but I guess it will problematic too because same reasons that explain above.
Thanks
C
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028318#4028318
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4028318
19Â years, 1Â month
[JBoss Seam] - SEAM - TRINIDAD - @Restrict
by FabBoco
Hi,
I actually need help ! I am getting crazy tring to configure Seam security
(SEAM 1.2.0.PATCH1)
I have been following istructions from twiki:
http://wiki.apache.org/myfaces/TrinidadSeamAjax4JsfFaceletDetail
and I am using the sample-web-1-2-0.xml file as web.xml
I have not ajax so I have removed the related lines.
First problem
When I deploy to jboss-4.0.5 I get the following error:
| .... StandardWrapper.Throwable
| java.lang.IllegalStateException: No Factories configured for this Application.
| This happens if the faces-initialization does not work at all - make sure
| that you properly include all configuration settings necessary for a basic
| faces application and that all the necessary libs are included. Also check
| the logging output of your web application and your container for any
| exceptions!
| If you did that and find nothing, the mistake might be due to the fact that
| you use some special web-containers which do not support registering
| context-listeners via TLD files and a context listener is not setup in your
| web.xml.
| A typical config looks like this;
| <listener>
| <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
| </listener>
|
Then I had at the very top of web.xml and I am able to deploy.
This behavior is different from which described onto the wiki. All the
indicated libraries are into the WEB-INF/lib.
Second Problem - The PROBLEM
I am trying to use SEAM security and I have annotated a session bean method
with
@Restrict ("#{s:hasRole('Administrator')}")
and I have put an exception into the pages file:
| <exception class="org.jboss.seam.security.AuthorizationException">
| <end-conversation before-redirect="true" />
| <redirect view-id="/Error.xhtml">
| <message severity="warn">message</message>
| </redirect>
| </exception>
|
When an unauthorized user try to call the method the error is not intercepted,
my Error.xhtml is not shown and I get the following error on the jboss
console:
| 11:07:53,624 ERROR [STDERR] Mar 15, 2007 11:07:53 AM
| com.sun.facelets.FaceletViewHandler handleRenderException
| SEVERE: Error Rendering View[/list/ProgettoList.xhtml]
| org.jboss.seam.security.AuthorizationException: Authorization check failed for
| expression [#{s:hasRole('Administrator')}]
| at
| org.jboss.seam.security.Identity.checkRestriction(Identity.java:162)
| at
| org.jboss.seam.interceptors.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:35)
| at
| org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at
| org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
| at
| org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at
| org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
| at
| org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:52)
| at
| anomalie.manager.managerInterface.ProgettoManager$$EnhancerByCGLIB$$9cdb4989.findAll(<generated>)
| 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:121)
| at org.jboss.seam.Component.callComponentMethod(Component.java:1802)
| at
| org.jboss.seam.Component.getInstanceFromFactory(Component.java:1664)
| at org.jboss.seam.Component.getInstance(Component.java:1601)
| at org.jboss.seam.Component.getInstance(Component.java:1578)
| at
| org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:53)
| at
| org.apache.myfaces.trinidadinternal.el.TrinidadVariableResolver.resolveVariable(TrinidadVariableResolver.java:55)
| at
| org.apache.myfaces.trinidadinternal.el.TrinidadVariableResolver.resolveVariable(TrinidadVariableResolver.java:55)
| at
| org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
| at
| com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
| at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
| at
| com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
| at
| com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
| at
| com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
| at
| org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:68)
| at
| org.apache.myfaces.trinidad.component.UIXComponentBase.getProperty(UIXComponentBase.java:1119)
| at
| org.apache.myfaces.trinidad.component.UIXIterator.getValue(UIXIterator.java:397)
|
As you can see, the handler which is responding is
com.sun.facelets.FaceletViewHandler
so I think that the reason why my error page is shown is that the
SeamFaceletViewHandler is not (correctly) installed despite my indication in
web.xml
Third Problem
The SEAM documentation ask to put
<view-handler>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</view-handler>
into the faces-config.xml.
If I do that, I get the following error when I call my first application page:
| java.lang.IllegalStateException: No RenderingContext
| at
| org.apache.myfaces.trinidad.render.CoreRenderer.encodeBegin(CoreRenderer.java:159)
| at
| org.apache.myfaces.trinidad.component.UIXComponentBase.encodeBegin(UIXComponentBase.java:671)
| at
| com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
| at
| com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
| at
| com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
| 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.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| 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.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:210)
| at
| org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:167)
| at
| org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:140)
| at
| org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:93)
| 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)
|
Is there any body out there that can help me ?
Thank you in advance
Fabrizio
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028314#4028314
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4028314
19Â years, 1Â month