[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1318) Seam 1.2.1.GA Integration Testing of #{identity.login}; NullPointerException in SeamLoginModule.java:104
by Maarten Haubrich (JIRA)
Seam 1.2.1.GA Integration Testing of #{identity.login}; NullPointerException in SeamLoginModule.java:104
--------------------------------------------------------------------------------------------------------
Key: JBSEAM-1318
URL: http://jira.jboss.com/jira/browse/JBSEAM-1318
Project: JBoss Seam
Issue Type: Bug
Components: Security
Affects Versions: 1.2.1.GA
Environment: Windows XP SP2, JRE 1.5.0_10, JBoss 4.0.5.GA
Reporter: Maarten Haubrich
I am having problems with the integration testing of the login process with the 1.2.1.GA version.
Upon invoking #{identity.login} I get a NullPointerException in the SeamLoginModule.
I suspect the test environment does not load the authenticate-method from the components.xml ...
Here is the JSF view
[CODE]
<h:form>
<table cellspacing="2" cellpadding="2" border="0" >
<tr>
<td>#{messages['login.login']}:</td><td><h:inputText value="#{identity.username}" id="login" /></td>
</tr>
<tr>
<td>#{messages['login.pwd']}:</td><td><h:inputSecret value="#{identity.password}" id="password" /></td>
</tr>
<tr>
<td colspan="2" align="right"><h:commandButton value="#{messages['login.button']}" action="#{identity.login}" /></td>
</tr>
</table>
</h:form>
[/CODE]
I added this to components.xml :
[CODE]
<security:identity authenticate-method="#{authenticator.authenticate}"/>
[/CODE]
My AuthenticatorAction class looks like so:
[CODE]
@Name("authenticator")
public class AuthenticatorAction implements Serializable
{
private static final long serialVersionUID = 4836686434984261542L;
private static final String USER_VAR = "currentUser";
@In
private Context sessionContext;
@Logger
private Log log;
/**
* validate the username and password
*/
public boolean authenticate()
{
User user = ServiceLocator.instance() // find user in database
.getLoginService()
.authenticate(Identity.instance().getUsername(), Identity.instance().getPassword());
if(user==null)
{
log.debug("invalid login!");
return false;
}
Identity.instance().addRole("user");
if(user.isAdmin()) // add admin role if the user is an admin
Identity.instance().addRole("admin");
sessionContext.set(USER_VAR, user); // save in session context
log.debug("login successful: #0", user);
return true;
}
}
[/CODE]
My SeamTest class is as follows:
[CODE]
public class AuthenticatorActionTest extends SeamTest {
@Test
public void testAuthenticate() throws Exception
{
new FacesRequest()
{
@Override
protected void updateModelValues() throws Exception
{
setValue("#{identity.username}", "test"); // inject the login values
setValue("#{identity.password}", "test");
}
@Override
protected void invokeApplication()
{
invokeMethod("#{identity.login}");
}
@Override
protected void renderResponse()
{
assertTrue("identity.loggedIn", getValue("#{identity.loggedIn}").equals(true)); // TEST FAILS HERE !
}
}.run();
}
}
[/CODE]
When running the test I get the following error message:
[CODE]
ERROR 2007-05-08 11:59:49,578 org.jboss.seam.security.jaas.SeamLoginModule -- Error invoking login
method
java.lang.NullPointerException
at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.security.auth.login.LoginContext.invoke(Unknown Source)
at javax.security.auth.login.LoginContext.access$000(Unknown Source)
at javax.security.auth.login.LoginContext$5.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokeCreatorPriv(Unknown Source)
at javax.security.auth.login.LoginContext.login(Unknown Source)
at org.jboss.seam.security.Identity.authenticate(Identity.java:247)
at org.jboss.seam.security.Identity.authenticate(Identity.java:240)
at org.jboss.seam.security.Identity.login(Identity.java:170)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.el.parser.AstValue.invoke(AstValue.java:174)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
at org.jboss.seam.util.UnifiedELMethodBinding.invoke(UnifiedELMethodBinding.java:36)
at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper
.java:58)
at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper
.java:58)
at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
at org.jboss.seam.mock.SeamTest$Request.invokeMethod(SeamTest.java:401)
at com.booknolia.AuthenticatorTest$1.invokeApplication(AuthenticatorTest.java:48)
at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:489)
at com.booknolia.AuthenticatorTest.testAuthenticate(AuthenticatorTest.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:645)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:479)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:715)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.runWorkers(TestRunner.java:673)
at org.testng.TestRunner.privateRun(TestRunner.java:620)
at org.testng.TestRunner.run(TestRunner.java:480)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:278)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:273)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:253)
at org.testng.SuiteRunner.run(SuiteRunner.java:168)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:987)
at org.testng.TestNG.runSuitesLocally(TestNG.java:951)
at org.testng.TestNG.run(TestNG.java:719)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)
[/CODE]
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 8 months
[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-1103) Deploying Seam example app into /trunk causes ZipException
by Gavin King (JIRA)
[ http://jira.jboss.com/jira/browse/JBSEAM-1103?page=all ]
Gavin King updated JBSEAM-1103:
-------------------------------
Fix Version/s: 1.3.1.BETA1
(was: 1.3.0.ALPHA)
> Deploying Seam example app into /trunk causes ZipException
> ----------------------------------------------------------
>
> Key: JBSEAM-1103
> URL: http://jira.jboss.com/jira/browse/JBSEAM-1103
> Project: JBoss Seam
> Issue Type: Bug
> Components: Core
> Environment: r61655 of /trunk and jboss-seam-1.2.0.PATCH1
> Reporter: Charles Crouch
> Fix For: 1.3.1.BETA1
>
> Attachments: cglib-nodep-2.1_3.jar, el-api.jar, el-ri.jar, jboss-seam-numberguess.ear
>
>
> Deploying a modified version of jboss-seam-numberguess.ear into the current Beta2 server causes ZipException's to be thrown during startup and trying to hit http://localhost:8080/seam-numberguess produces 500's. Deploying the same app into Beta1 works fine.
> Steps to reproduce:
> 1) Copy
> jboss-seam-1.2.0.PATCH1\lib\el-api.jar
> and
> jboss-seam-1.2.0.PATCH1\lib\el-ri.jar
> to
> build\output\jboss-5.0.0.Beta2\server\default\deployers\jbossweb.deployer\jsf-libs
> 2) Copy
> cglib-nodep-2.1_3.jar (version probably doesn't matter)
> to
> build\output\jboss-5.0.0.Beta2\server\default\lib
> 3) Copy modified jboss-seam-numberguess.ear
> to
> build\output\jboss-5.0.0.Beta2\server\default\deploy
> 4) Start the server and you get several exceptions like the following...
> 12:09:11,896 INFO [Catalina] Server startup in 190 ms
> 12:09:20,769 INFO [MCKernelAbstraction] installing bean: jboss.j2ee:ear=jboss-seam-numberguess.ear,jar=jboss-seam.jar,name=Dispatcher,service=EJB3 with dependencies:
> 12:09:24,244 INFO [EJBContainer] STARTED EJB: org.jboss.seam.core.Dispatcher ejbName: Dispatcher
> 12:09:24,484 WARN [JBossTimerServiceFactory] TIMER SERVICE IS NOT INSTALLED
> 12:09:24,484 INFO [MCKernelAbstraction] installing bean: jboss.j2ee:ear=jboss-seam-numberguess.ear,jar=jboss-seam.jar,name=TransactionListener,service=EJB3 with dependencies:
> 12:09:26,216 INFO [EJBContainer] STARTED EJB: org.jboss.seam.core.TransactionListener ejbName: TransactionListener
> 12:09:29,441 INFO [TomcatDeployment] deploy, ctxPath=/invoker, vfsUrl=http-invoker.sar/invoker.war
> 12:09:35,319 INFO [TomcatDeployment] deploy, ctxPath=/seam-numberguess, vfsUrl=jboss-seam-numberguess.ear/jboss-seam-numberguess.war
> 12:09:38,895 INFO [ServletContextListener] Welcome to Seam 1.2.0.PATCH1
> 12:09:38,995 INFO [Scanner] scanning: vfsfile:/C:/usr/projects/current/jboss/trunk/build/output/jboss-5.0.0.Beta2/server/default/deploy/jboss-seam-numberguess.ear/jboss-seam.jar
> 12:09:38,995 WARN [Scanner] could not read entries
> java.util.zip.ZipException: The filename, directory name, or volume label syntax is incorrect
> at java.util.zip.ZipFile.open(Native Method)
> at java.util.zip.ZipFile.<init>(ZipFile.java:203)
> at java.util.zip.ZipFile.<init>(ZipFile.java:234)
> at org.jboss.seam.deployment.Scanner.handleArchive(Scanner.java:110)
> at org.jboss.seam.deployment.Scanner.scan(Scanner.java:96)
> at org.jboss.seam.deployment.NamespaceScanner.getPackages(NamespaceScanner.java:34)
> at org.jboss.seam.init.Initialization.addNamespaces(Initialization.java:590)
> at org.jboss.seam.init.Initialization.<init>(Initialization.java:80)
> at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
> at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 8 months