[JBoss Seam] - Tests on EJB3 that uses JAAS
by endremr
Hello!
I'm trying to write tests for my EJB3's that uses Java security roles and JAAS. When I run my tests, I get exceptions with "jaas not bound" since the embedded-ejb hasn't set up the JAAS stuff.
I found this wiki page:
http://wiki.jboss.org/wiki/Wiki.jsp?page=EmbeddedJaasSecurityManagerService
...that describes how to set up JAAS in embedded JBoss EJB3. I have added the jar into my classpath, but I don't know where to add the needed Java code.
I have tried to override "SeamTest.init" like this:
public void init() throws Exception {
logger.debug("### MY INIT ###");
EJB3StandaloneBootstrap.deployXmlResource("security-deployment.xml");
super.init();
}
...but this gives me the following stack trace:
java.lang.NullPointerException
at org.jboss.seam.contexts.WebApplicationContext.get(WebApplicationContext.java:47)
at org.jboss.seam.contexts.WebApplicationContext.get(WebApplicationContext.java:80)
at org.jboss.seam.core.Init.instance(Init.java:50)
at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1283)
at org.jboss.seam.Component.getInstance(Component.java:1260)
at org.jboss.seam.Component.getInstance(Component.java:1253)
at org.jboss.seam.Component.getInstance(Component.java:1235)
at org.jboss.seam.core.Manager.instance(Manager.java:303)
at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:187)
at org.jboss.seam.mock.SeamTest.end(SeamTest.java:297)
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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:552)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:318)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:152)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:483)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:778)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.privateRun(TestRunner.java:682)
at org.testng.TestRunner.run(TestRunner.java:566)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:220)
at org.testng.SuiteRunner.run(SuiteRunner.java:146)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:713)
at org.testng.TestNG.runSuitesLocally(TestNG.java:676)
at org.apache.maven.surefire.testng.TestNGExecutor.executeTestNG(TestNGExecutor.java:64)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
myFirstTest Time elapsed: 0.182 sec <<< FAILURE!
java.lang.RuntimeException: java.lang.IllegalArgumentException: Null kernel
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.deployXmlResource(EJB3StandaloneBootstrap.java:95)
at no.schibstedsok.wp.ejb3.entity.PersonCorrectionTest.init(PersonCorrectionTest.java:25)
at no.schibstedsok.wp.ejb3.entity.PersonCorrectionTest.myFirstTest(PersonCorrectionTest.java:33)
What are the status on JAAS in SeamTests? Has anybody got it working or isn't SeamTest ready for it yet?
Thanks for advice :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982636#3982636
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982636
19Â years, 6Â months
[JBoss jBPM] - Connection (transaction problem)
by mduarte
Sorry all, but I could not find the anwers in the forum.
I am using jBPM as a jar of my server. And my server has its own database. So I have some operations that "integrate" some jbpm tables with my tables.
The problem is when I have a foreign key for a database table. e.g. When I deploy a process definition I have to insert some data in another table with a foreign key to the process definition id.
The problem is the transaction control. as I did not commit my deploy I do not have how to insert a data that has some dependencies of the process definition.
To solve that I thing there is two options:
1. Get the same connection used by jbpm to deploy the process definition and use it to create my statements;
2. Set jbpm to in some cases use a jdbc connection created by me.
is there anyway to do that? the second option could be much better
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982633#3982633
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982633
19Â years, 6Â months
[JBoss Seam] - Integration of Seam Components with JSF
by keithpitty
Firstly, my apologies if this question is answered elsewhere - I've browsed the Reference Guide and searched the forum without finding the answer yet. I'm relatively new to Seam and am hoping that someone can give me some quick insight.
So, as I understand it, Seam enables EJB 3.0 components to seamlessly integrate with JSF i.e. no need for beans to be configured in JSF via faces-config.xml. In the Ref Guide in section 9.1.1 (Integrating Seam with JSF and your servlet container) I see that org.jboss.seam.servlet.SeamListener is defined as a listener in web.xml and org.jboss.seam.jsf.SeamPhaseListener is defined as a phase listener for the JSF lifecylce in faces-config.xml.
So, my question is: how does Seam achieve the seamless integration? Is it via annotations?
Keith
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982632#3982632
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982632
19Â years, 6Â months
[JBoss Eclipse IDE (users)] - IDE2.0.0 packing and deployment
by cdreyer1
I'm trying to understand the packing and deployment functions of the JBoss IDE.
The environment is
- JBoss IDE 2.0.0 beta 2
- Jboss AS 4.0.5
- and I have created a Dynamic Web Project (a servlet) called TestApp
Selecting "Run on Server" will copy project files from the directories build and WebContent from my project to \.metadata\.plugins\org.eclipse.wst.server.core\tmp0\TestApp. Then a JBoss IDE Ant publish file called jboss.publish.xml will be executed to create a WAR file. The WAR file is then moved to the deploy directory of my JBoss AS server.
My questions are:
1) It seem that the Packing Configurations feature of Eclipse is disconnected from this process and has no impact. Is this true?
2) Why copy the project files from one place (the project) to another place and then pack them into a WAR file?
3) What is the proper way of modifying the build process with the JBoss IDE? Should I modify the jboss.publish.xml or create a new Ant build file?
Thanks!
Best regards,
Claus Dreyer
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982629#3982629
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982629
19Â years, 6Â months