[JBoss Portal] - Re: Servlet calling java:portal/UserModule
by foongkim
yes, i got what you mean. this is my latest code change after i have also search the forum in here. BUt then another problem occur...
Transaction transaction = null;
Session session = null;
SessionFactory identitySessionFactory = 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");
System.out.println("$$$$$$$$ " + userModule.findUserByUserName("admin"));
// User temp_user = userModule.findUserByUserName("foongkim");
// authenticateUser = temp_user.validatePassword(password);
}
catch (Exception e)
The NullPointerException throw to me. pointing to
>> session = identitySessionFactory.openSession();
in my project,i have included the portlet-indentity-lib.jar which is from [JBOSS_HOME]/deploy/Jboss-portal.sar/lib
what else i missed out?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138248#4138248
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138248
18 years, 1 month
[JBoss Portal] - Re: content rendering in minimize mode
by Antoine_h
yes
you can define a custom window state : look at the jsr-168 about this, and then at the implementation in jboss portal (doc, wiki, forum...)
there are a few samples about that (for what I remember, there is an example of "half size maximized" or something like that).
then, as you noticed it, you can have a specific layout for this window state.
for what i remember, you define this in one of the descriptor, in the layout part (descriptors for the layout).
follow the maximized layout sample about that.
**********************************************
you can do a lot of thing with the windows mode, the layouts etc...
the portal is very flexible and allow many thing.
So you should be able to do what you want to do by pluging/adapting your need in the minimized mode.
if really there is something that does not fit your need, then you may build a new window mode.
I guess the question to ask is : does your mode is a minimized mode, with some small adaptation ?
or is it a very different mode, that should be implemented in its own mode ?
**********************************************
about the anonymous wrote : <render-on-minimized>true</render-on-minimized>
I did not know about this new feature...
nice !
some companies I worked with for setting a portal asked for this in the minimized mode.
To be able to write a little message in the minimized portlet view, like "click here to see more about this blah blah..."
Thanks !
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138243#4138243
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138243
18 years, 1 month
[JBoss Portal] - Re: Servlet calling java:portal/UserModule
by Antoine_h
Globally, you need to provide a transaction to the UserModule.
more detail :
the UserModule uses hibernate to query the database about the user.
it will do so inside a JTA transaction, for all the advantages of using transactions with database processing.
but, the user module does not build it's own transaction.
it must be provided by the container.
the container provide the transaction to any instance who ask for it.
This is usually done by injection.
in the portlets, the injection of the transaction is done by adding the "transaction required" element in the portlet descriptor. This is in the jboss-portlet.xml description file.
you can see this in the jboss-portlet.xml that is in the identity module (see the identity sar)
in your servlet, there is no (not yet) the transaction injection, for the user module.
you have to tell that your servlet processing needs a transaction.
that's where I am not sure anymore : I don't know much about the servlet.
but I guess that with some annotation, you should get this transaction injected on the servlet methods etc...
search in the web about : transaction injection servlet tomcat etc...
look also about the transaction manager of jboss : may be also possible to call it by jndi and get the current transaction for the current thread etc...
look also at hibernate / transaction / injection etc...
hope this help for a start
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138240#4138240
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138240
18 years, 1 month
[JBoss Portal] - Servlet calling java:portal/UserModule
by foongkim
Hi there, i have one portal running on Jboss and one is the servlet. In my servlet, i will required to call the usertable in JBP_USer to verify the user registered already or not?
Thus, below is part of the coding...
try
{
UserModule userModule = (UserModule) new InitialContext().lookup("java:portal/UserModule");
User temp_user = userModule.findUserByUserName(username);
authenticateUser = temp_user.validatePassword(password);
}
catch (Exception e)
I have not problem on loading the JNDI UserModule. But once i call the findUserByUseName(), i was thrown an error:
org.hibernate.HibernateException: Unable to locate current JTA transaction
at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:544)
at org.jboss.portal.identity.db.HibernateUserModuleImpl.getCurrentSession(HibernateUserModuleImpl.java:298)
at org.jboss.portal.identity.db.HibernateUserModuleImpl.findUserByUserName(HibernateUserModuleImpl.java:90)
at my.mimos.servlet.ProfileSendServlet.doGet(ProfileSendServlet.java:96)
SO, basically if i understand correctly, it's pointing to me can not load the user transaction. Can you help me or suggest any solution to me?
thank you
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138238#4138238
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138238
18 years, 1 month