[JBoss Portal] - How to get user role in custom login ?
by liutaiyo
I configured the portal login using DatabaseServerLoginModule
And I want to get the user role at
jboss-portal.sar\portal-core.war\WEB-INF\jsp\loginindex.jsp
Below is the code adding to the index.jsp to retrieve the user role.
But i can't get the user role which only create in our custom database.
It only work on default portal user (user / admin)
How can i get the role name of the login user?
<%
try{
Context initContext = new InitialContext();
RoleModule role = (RoleModule)initContext.lookup("java:/portal/RoleModule");
UserModule user = (UserModule)initContext.lookup("java:/portal/UserModule");
String username = request.getRemoteUser();
if(username != null){
if(role != null){
%>
HAS ROLE <%= username %> ROLE COUNT = <%=role.getRolesCount() %>
<%
User u = null;
if(user != null){
//u = user.findUserByUserName(username);
}else{
%>
NO USER OBJECT
<%
u = new UserImpl(username);
}
if(u != null){
Set s = role.getRoles(u);
Iterator i = s.iterator();
while(i.hasNext()){
Role r = (Role)i.next();
%>
AA <%= r.getName() %>
<%
}
}
%>
HAS ROLE
<%
}else{
%>
NO ROLE
<%
}
}
}catch(Exception e){
e.printStackTrace();
%>
System Exception
<%
}
%>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033001#4033001
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033001
17Â years, 9Â months
[JBoss Seam] - Re: Deploying JBoss Seam Booking JPA example to WebLogic 9.1
by mgrouch
Putting ejb3-persistence.jar before weblogic.jar on JVM classpath solved this problem.
I've got a new one though
Unable to resolve 'examples-dataSource-demoPool'
anonymous wrote :
| <Mar 29, 2007 11:42:42 PM EDT> <BEA-149231> <Unable to set the activation state to true for the application 'jboss-seam-jp
| a'.
| weblogic.application.ModuleException:
| at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:876)
| at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:326)
| at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:114)
| at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
| at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
| at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
| at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:25)
| at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:640)
| at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
| at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:252)
| at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
| at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
| at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:176)
| at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:347)
| at weblogic.management.deploy.internal.DeploymentAdapter$1.activate(DeploymentAdapter.java:50)
| at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
| at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:232)
| at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:168)
| at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
| at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
| at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
| at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
| at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
| at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
| at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
| javax.naming.NameNotFoundException: Unable to resolve 'examples-dataSource-demoPool'. Resolved ''; remaining name 'examples-dataSource-demoPo
| ol'
| at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1123)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033000#4033000
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033000
17Â years, 9Â months
[JBoss Seam] - Re: Deploying JBoss Seam Booking JPA example to WebLogic 9.1
by mgrouch
I've found this post on Bea forums
anonymous wrote :
| # Exception in thread "main" java.lang.NoSuchMethodError: javax.persistence.EntityManagerFactory.getEntityManager()Ljavax/persistence/EntityManager;
|
| Curious, I think this could be a bug from Hibernate or ejb3-persistance implementation.
|
| * Problems using JPA implemented by Hibernate in Weblogic 9.1
| 2006-10-02 01:52:00 konrad_a(a)poczta.fm [Reply | View]
|
| The cause of NoSuchMethodError is that weblogic.jar contains javax.persisence.EntityManager interface which is in conflict with JPA 1.0 (EJB 3.0) persistence.jar shipped with Hibernate 3.2. As weblogic.jar is first on the classpath, the problem occurs. The solution is to copy "persistence.jar" to WL's JDK lib/ext dir (normally it is bea/jdk150_03/jre/lib/ext) and restart the server.
|
I will try that.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032998#4032998
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032998
17Â years, 9Â months
[Remoting] - Unable to connect to server using SimpleClient.java
by rajesh_joshi
Hello,
I am a first time user of JBoss Remoting. We hava a 3rd party server that I need to connect to using plain sockets. I can connect to the server using telnet and I was also able to connect to the server using conventional java socket programming code.
However, when I use the SimpleClient.java programme to connect I get error. Not sure what the problem is. I am using JBoss Remoting as a standalone framework for connection and it's JBossRemoting-2_2_0_GA.
Appreciate any help in resolving this issue. Thank you.
RJ.
ant run-simple-client
Buildfile: build.xml
compile-sample-classes:
run-simple-client:
[java] Calling remoting server with locator uri of: socket://i1qa:5003
[java] Invoking server with request of ''
[java] org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://i1qa:5003/]
[java] at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:525)
[java] at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
[java] at org.jboss.remoting.Client.invoke(Client.java:1544)
[java] at org.jboss.remoting.Client.invoke(Client.java:530)
[java] at org.jboss.remoting.Client.invoke(Client.java:518)
[java] at org.jboss.remoting.samples.simple.SimpleClient.makeInvocation(Unknown Source)
[java] at org.jboss.remoting.samples.simple.SimpleClient.main(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:202)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:134)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:710)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:178)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:84)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:341)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:668)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:187)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
[java] Caused by: java.lang.reflect.InvocationTargetException
[java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032996#4032996
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032996
17Â years, 9Â months