Re: Local ejb access vs remote access
by samk@twinix.com
See Thread at: http://www.techienuggets.com/Detail?tx=59823 Posted on behalf of a User
I have the same problem, trying to find whats wrong. Now I think the problem is with XDoclet.
In Response To:
I'm trying to figure out why remote access to my EJB works but local access doesn't seem to. If I create a test remote test client using the following code, everything seems to work fine.
| Hashtable env = new Hashtable();
| env.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
|
| try {
| LeagueFacade leagueFacade = LeagueFacadeUtil.getHome(env).create();
| League league = leagueFacade.findLeague(1);
|
If I use the following code in a jsp or servlet deployed as part of the same EAR into the Jboss container, I get an exception (failing on the call to LeagueFacadeUtil.getHome() ).
| LeagueFacadeHome h = LeagueFacadeUtil.getHome();
| LeagueFacade l = h.create();
| League league = l.findLeague(1);
| Iterator schedules = league.getSchedules()
| .iterator();
|
| java.lang.ClassCastException
| com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
| javax.rmi.PortableRemoteObject.narrow(Unknown Source)
| com.leagueplanet.ejb.LeagueFacadeUtil.lookupHome(LeagueFacadeUtil.java:25)
| com.leagueplanet.ejb.LeagueFacadeUtil.getHome(LeagueFacadeUtil.java:42)
| org.apache.jsp.schedule_jsp._jspService(schedule_jsp.java:78)
|
If I try to add an initial context environment as I did for the remote client, I get a different exception and it fails on the call to LeagueFacadeHome.create()
| root cause
|
| java.rmi.ServerException: EJBException:; nested exception is:
| javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract com.leagueplanet.ejb.LeagueFacade com.leagueplanet.ejb.LeagueFacadeHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
| org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:365)
| org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:136)
| org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
| org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer
|
I'm obviously missing something but can't quite figure out what it is. BTW, this is the basic code from the WTP book, which was aimed at a JBoss 4.0 deployment.
Thanks,
mark
16 years
[JBoss jBPM] - how to dynamically override a swimlane at the time of execut
by sumit.jbpm
Elaboration:- Say suppose I am defining a processdefinition.xml which contains only one task-node (containg only one task). I have defined a swimlane (using actor-id tag like: actor-id="user1").
Now at the time of execution (once the processinstance is getting created) if I want to override the swimlane with "user2", will JBPM allow that? If yes, how? And if not, why?
What I tried:-
ProcessDefinition.xml -->
<?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition
| xmlns="urn:jbpm.org:jpdl-3.1" name="ActorSwimlaneProcess">
| <swimlane name="AD">
| <assignment actor-id="user1"></assignment>
| </swimlane>
| <start-state name="start">
| <transition name="toNode" to="TaskNode"></transition>
| </start-state>
| <task-node name="TaskNode">
| <task name="task1" swimlane="AD">
| <event type="task-create">
| <action class="com.framework.workflow.handlers.ActorSwimlaneHandler" />
| </event>
| </task>
| <transition name="toEnd" to="end">
| </transition>
| </task-node>
| <end-state name="end"></end-state>
| </process-definition>
code snippet contained in ActorSwimlaneHandler.java -->
.....
| long taskId = executionContext.getTaskInstance().getId();
| TaskInstance ti = executionContext.getJbpmContext().getTaskInstance(taskId);
| SwimlaneInstance si = executionContext.getTaskInstance().getSwimlaneInstance();
| si.setActorId("user2");
| ti.setSwimlaneInstance(si);
| executionContext.getJbpmContext().save(ti);
| .....
code snippet being used to createProcessInstance -->
.......
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| GraphSession graphSession = jbpmContext.getGraphSession();
| ProcessDefinition processDefinition = graphSession.findLatestProcessDefinition(processDefinitionName);
| ProcessInstance processInstance = new ProcessInstance(processDefinition);
| processInstanceID = processInstance.getId();
| jbpmContext.save(processInstance);
|
| // Initiate the flow
| Token token = processInstance.getRootToken();
| jbpmContext.save(token);
| token.signal();
| jbpmContext.close();
| .......
|
Please reply soon. If you have any approximate idea then also share that with me.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4193412#4193412
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4193412
16 years
[Security & JAAS/JBoss] - JndiLoginInitialContextFactory in JBoss 5.0.0.CR2
by bdreher
In JBoss 4.2.x I was using org.jboss.security.jndi.JndiLoginInitialContextFactory as initial context factory to define in an application client module the name of the login user and password. By this the login user id and password were transferred to the DatabaseServerLoginModule and could there be verified and the corresponding roles could be fetched.
The transfer of security principal and credentials to the DatabaseServerLoginModule does no longer work in JBoss 5.0.0.CR2.
Part of the relavent code:
Properties props = new Properties();
| props.setProperty(Context.SECURITY_PRINCIPAL, "admin");
| props.setProperty(Context.SECURITY_CREDENTIALS, "admin");
| props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
| props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
| props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
| props.setProperty("j2ee.clientName", "ReiseshopTestClient");
|
| Context ctx = new InitialContext(props);
| session = (ReiseSessionRemote) ctx.lookup("ReiseSessionBean");
Is it possible to fix this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4193375#4193375
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4193375
16 years