[JBoss Seam] - Authenticate every request
by renspr
Hi,
I setup a new project using Seam 2.0.0.GA. On every Seam page request I need to autenticate the user against a proprietary system. I created an 'authenticator' component, and set 'authenticate-every-request' to 'true'.
| <security:identity
| authenticate-method="#{authenticator.authenticate}"
| authenticate-every-request="true"/>
|
My authenticate() method is NOT called on every page request. I checked the current CVS head version and noticed that 'authenticateEveryRequest' has been removed from the Identity component with the comment 'removed unused fields/methods, minor'.
How to configure Seam that for every page request the authenticate method will be called?
Thanks in advance, regards,
Rene
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111308#4111308
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111308
18 years, 4 months
[JBoss Messaging] - Messaging 1.3 Clustering question
by nbakizada
I am having trouble either configuring things or understanding how they are supposed to work.
I have a cluster of 2 nodes (ServerPeer 0 and 1). Jboss messaging 1.3 has been setup on both with the clustering configuration (using the correct clustered-oracle-persistence.xml configuration).
The 2 nodes see each other just fine. If I take one down, I see the other one being notified and updating its cluster map, and vice versa.
I have defined one clustered queue (which I want to behave as a virtual queue). To do this, I defined a destination for this queue on each of the 2 nodes. I assume it needs to created on both nodes, even though it is supposed to appear as one virtual queue to the client. Is this correct?
The client connects to the queue using the ClusteredConnectionFactory and a HAJNDI lookup to something like <IPofServer0:1100, IPofServer1:1100>.
After sending 500 messages, I noticed that all of them show up on the queue of Server 0 and none on Server 1, even with the policy set to round robin. Further more, if i take server 0 down, the 500 messages are still NOT accessible on Server 1. My understanding was that jboss-messaging clustering would allow for the messages to either be replicated or somehow made available to the client even if one of the Servers went down. Is this correct? What am I missing?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111300#4111300
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111300
18 years, 4 months
[Beginners Corner] - Call an ejb from Servlet in different application
by bpet36
Has anyone been able to successfully call an ejb from a servlet that is deployed in a separate ear file, where both are deployed via JBoss.
I have ServletA that is deployed in app1.ear and EJB1 that is deployed in app2.ear.
I attempt to lookup the ejb from ServletA, but it fails and the following exception is caught
SEVERE: object is not an instance of declaring class
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java
:258)
at $Proxy262.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at mil.navy.admacs.DiscoveryManager.discover(DiscoveryManager.java:107)
web.xml for servlet which resides in app2.ear
<ejb-ref>
<ejb-ref-name>ejb/User/EJB1</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
com.ssi.ejb.EJB1Home
mil com.ssi.ejb.EJB1
</ejb-ref>
jboss-web.xml for servlet which resides in app2.ear
<ejb-ref>
<ejb-ref-name>ejb/User/EJB1</ejb-ref-name>
<jndi-name>ejb/User/EJB1</jndi-name>
</ejb-ref>
ejb-jar.xml file for EJB resides in app1.ear:
UserBeanSession
<display-name>UserBeanSession</display-name>
<ejb-name>UserBean</ejb-name>
com.ssi.ejb.EJB1Home
com.ssi.ejb.EJB1
<ejb-class>com.ssi.ejb.EJB1Session</ejb-class>
<session-type>Stateless</session-type>
Any ideas, thanks in advance!
Bob
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111298#4111298
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111298
18 years, 4 months
[JBoss Seam] - Integration Testing Seam Mail
by poiu77
Hello.
I'm trying run a test from Pete Muir blog site about testing seam email.
Test code example
| public class EmailAktywacyjnyTest extends SeamTest {
|
| @Test
| public void testowanieWiadomosci() throws Exception {
| new FacesRequest() {
| @Override
| protected void invokeApplication() throws Exception {
| MimeMessage renderedMessage = getRenderedMailMessage("/emailAktywacyjny.xhtml");
| assert renderedMessage.getAllRecipients().length == 1;
| InternetAddress to = (InternetAddress) renderedMessage.getAllRecipients()[0];
| assert to.getAddress().equals("test(a)example.com");
| }
| }.run();
| }
| }
|
I get error in line :
MimeMessage renderedMessage = getRenderedMailMessage("/emailAktywacyjny.xhtml");
| FAILED: testowanieWiadomosci
| java.lang.AssertionError: java.lang.NullPointerException
| at org.jboss.seam.mock.BaseSeamTest$Request.onException(BaseSeamTest.java:475)
| at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:526)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
| at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:514)
| at pl.fotowycieczkatest.EmailAktywacyjnyTest.testowanieWiadomosci(EmailAktywacyjnyTest.java:14)
| Caused by: java.lang.NullPointerException
| at org.jboss.seam.mock.BaseSeamTest$Request.getRenderedMailMessage(BaseSeamTest.java:820)
| at pl.fotowycieczkatest.EmailAktywacyjnyTest$1.invokeApplication(EmailAktywacyjnyTest.java:17)
| at org.jboss.seam.mock.BaseSeamTest$Request.invokeApplicationPhase(BaseSeamTest.java:652)
| at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:598)
| at org.jboss.seam.mock.BaseSeamTest$Request.access$300(BaseSeamTest.java:185)
| at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:519)
| ... 36 more
| ... Removed 22 stack frames
|
|
Could anyone tell me, what is wrong?
Thanks, poiu77
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111293#4111293
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111293
18 years, 4 months
[Beginners Corner] - How to handle configurable properties.
by jfrankman
When I deploy my applications as an EAR there are certain properties that must change based upon the runtime environment such as the port of the Naming service or Production/Test environment settings. Basically those types of things normally put in a properties file. What is the best way to handle environment properties for my EAR applications?
Right now I see three approaches:
1. Use a regular old properties file and unzip EAR
2. Use a regular old properties file and deploy exploded EAR
3. putting some jndi bindings in the jboss-service.xml file
The problem I see with 1 is that if I had to make changes, I would have to unzip the EAR, make the change, and then re-zip it up. I want to be able to make configuration changes without disrupting the application.
Option 2 looks promising, but I am not sure if I change a value in the properties file when the EAR application will recognize the value change.
I have settled on option 3, but I think this requires that I restart JBoss whenever I make a change to the bindings. Is there a better way to handle environment properties? I want to know what my options are so I can do some more research, but for now I am not sure where to start.
Thanks,
James
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111292#4111292
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111292
18 years, 4 months
[JBoss Seam] - configuration question
by laksu
Hi,
I have a 1.2.1 working project that I am trying to migrate to 2.0.0 GA.
To avoid issues with testng configuration I have started with a fresh seam-gen generated template."seam setup", "seam new project", "seam explode"
I copied my classes and pages into it. I left Glassfish aside for the time being, again to avoid configuration issues and converted to JBoss AS.
Due to some bug (http://jira.jboss.org/jira/browse/JBSEAM-2220) I decided to convert to annotations and leave hbm.xml configuration. I have a few mapping issues there because of this conversion but the whole thing is almost working.
Note that I use Hibernate for persistence instead of JPA and I had to have some modifications on top of the seam-gen generated template like preventing persistence.xml to be copied to the build etc.
Now, back to testing again I have a problem with configuration. This is probably due to my lack of knowledge about the embedded container and I cannot figure out a correct recipe from the examples, info provided in the manual and "seam-gen"erated project combined.
So I need your help:
Here follows my latest configuration files:
components.xml:
<core:init debug="@debug@" jndi-pattern="@jndiPattern@" />
|
| <core:manager concurrent-request-timeout="500"
| conversation-timeout="120000"
| conversation-id-parameter="cid"/>
|
| <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
| <persistence:managed-hibernate-session name="hibernateSession"
| auto-create="true"
| session-factory-jndi-name="java:/payrollSessionFactory"/>
|
| <persistence:hibernate-transaction session="#{hibernateSession}"/>
|
|
payroll-test-ds
<?xml version="1.0" encoding="UTF-8"?>
|
| <!DOCTYPE datasources
| PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
| "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
|
| <datasources>
|
| <local-tx-datasource>
| <jndi-name>payrollDatasource</jndi-name>
| <connection-url>jdbc:postgresql://192.168.10.79:5432/payroll_levent</connection-url>
| <driver-class>org.postgresql.Driver</driver-class>
| <user-name>postgres</user-name>
| <password>postgres</password>
| <metadata>
| <type-mapping>PostgreSQL 8.0</type-mapping>
| </metadata>
| <new-connection-sql>select 1</new-connection-sql>
| <check-valid-connection-sql>select 1</check-valid-connection-sql>
|
| </local-tx-datasource>
| </datasources>
|
I obviously have a missing link there deploying the payroll-test-ds.xml to the embedded container. Because I get the following:
[testng] FAILED CONFIGURATION: @BeforeClass init
| [testng] org.hibernate.HibernateException: Could not find datasource
| [testng] at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
| [testng] at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
| [testng] at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
| [testng] at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:397)
| [testng] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
| [testng] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006)
| [testng] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289)
| [testng] at org.jboss.seam.persistence.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:165)
| [testng] at org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateSessionFactory.java:79)
| [testng] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| [testng] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
| [testng] at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
| [testng] at org.jboss.seam.Component.callCreateMethod(Component.java:1997)
| [testng] at org.jboss.seam.Component.newInstance(Component.java:1968)
| [testng] at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
| [testng] at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
| [testng] at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
| [testng] at org.jboss.seam.init.Initialization.init(Initialization.java:555)
| [testng] at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:939)
| [testng] at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
| [testng] Caused by: javax.naming.NameNotFoundException: payrollDatasource not bound
| [testng] at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
| [testng] at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
| [testng] at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
| [testng] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
| [testng] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:628)
| [testng] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
| [testng] at javax.naming.InitialContext.lookup(InitialContext.java:351)
| [testng] at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
| [testng] ... 45 more
| [testng] ... Removed 26 stack frames
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111288#4111288
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111288
18 years, 4 months