[jboss-user] [JBoss Portal] - Re: Servlet calling java:portal/UserModule
foongkim
do-not-reply at jboss.com
Sat Mar 22 09:52:47 EDT 2008
guys, problem solved.
the NULL Pointer is because in my eclipse project, i have included the hibernate3.jar and it's seems its crashed with the hibernate3.jar inside the JBoss app server.
after i have removed the hibernate in my project (as i will use the JBoss), everything is working fine means i can pull the information from the portal user.
Below is the complete code.
SessionFactory identitySessionFactory = null;
Session session = null;
Transaction transaction = null;
try
{
identitySessionFactory = (SessionFactory) new InitialContext().lookup("java:portal/IdentitySessionFactory");
session = identitySessionFactory.openSession();
transaction = session.beginTransaction();
UserModule userModule = (UserModule) new InitialContext().lookup("java:portal/UserModule");
User temp_user = userModule.findUserByUserName(username);
authenticateUser = temp_user.validatePassword(password);
session.clear();
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
if (transaction != null)
transaction.commit();
if (session != null)
session.close();
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138422#4138422
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138422
More information about the jboss-user
mailing list