[EJB 3.0] - JNDI Naming question with EJB3 in JBoss: how to include the
by dkoslu@cleartalk.net
How can I control the JNDI names that JBoss seems to set up to point to my deployed EJB3 session beans.
For example, I may have a simple EAR project called "test.ear" containing "MyEJB.jar" with the following classes:
1) file packageName/LocalInterface.java:
package packageName;
@Local
public interface LocalInterface { ... }
2) file packageName/SSBImpl.java:
package packageName;
@Stateless
public class SSBImpl implements LocalInterface { ... }
Deploying test.ear in JBoss creates the reference "/test/SSBImpl/local" in the Global JNDI Namespace, which apparently points to the EJB3 proxy object for this bean.
My question is: how can I force it to deploy using a different JNDI name for this? In particular, I want to include the package name to avoid future naming conflicts, ie, "/test/packageName/SSBImpl/local".
thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003069#4003069
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003069
19 years, 3 months
[JBoss Seam] - Entity Id as Page Parameters (pages.xml)
by fabio.ita04
Hi,
I'm trying to write a simple application using Seam Framework, based on the seam reference documentation. I have a search screen, that displays a list of entities. For each entity on the list, there's a hyperlink that can be clicked to display an edit page.
Seam reference tells the developer to write the hyperlink as <s:link> with <f:param>, and declares that param at pages.xml, so it can be passed to EntityHome.
So I'm facing a problem: the param is passed to EntityHome as String, and EntityHome invokes
E result = getEntityManager().find( getEntityClass(), getId() );
but my entity identifier is Long typed, so hibernate throws
org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Long, got class java.lang.String.
How can I solve this?
Thanx,
Fábio.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003062#4003062
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003062
19 years, 3 months
[JBoss Seam] - Using @Factory annotation
by gsawant
I have a jsf page to edit user and a user can be a "supplier" or "admin".
If logged in as a "supplier" user can edit his profile and If logged in as a "admin" user can edit other users.
In EditUser.xhtml page I have single select list whose values are "supplier" or "admin" coming from a database. We call this list "eligibleGroups". Only admin can edit a users group.
<t:selectOneMenu value="#{viewUser.selectedRoleId}" enabledOnUserRole="Administration">
<f:selectItems value="#{eligibleGroups}" />
</t:selectOneMenu>
In seam action bean I have a method which intializes a list variable "eligibleGroups".
@Out(scope = ScopeType.SESSION)
private List eligibleGroups;
@Factory("eligibleGroups")
public void initializeGroups() {
if (eligibleGroups == null) {
eligibleGroups = new ArrayList();
String queryStr = "from Role r ";
Query query = em.createQuery(queryStr);
List roles = query.getResultList();
for (Role role : roles) {
eligibleGroups.add(new SelectItem(role.getId(), role.getName()));
}
}
}
If I try to access any part of EditUser.xhtml page after session expires my code logic brings back a login page and after successfull login tries to show EditUser.xhtnl because that was the last request.
However , before using @Factory annotation I was getting Error that eligibleGroups collection is null. So I decided to add a @Factory to the method which initializes variable "eligibleGroups".
This is giving me a [java] java.lang.IllegalArgumentException: create method not found
any help appreciated
geeta
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003058#4003058
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003058
19 years, 3 months
[Clustering/JBoss] - sibgleton service (cluster-wide)
by mhsheikh
I need to have a service that runs on one and only node, but is accessible from any node. Instead of using a HASingleton (which I can successfully deploy but have problems to invoke it from nodes other than primary), I decided to do this:
I use @Service to create a service POJO which is guranteed to be singleton per node. Now, when each node needs to invoke a method on the service, it looks up HA-JNDI for a predefined key (say MySingletonService). If it can't find it, it binds the remote stub of its local service EJB (../ServiceEJBName/remote) to the key (MySingletonService) in HA-JNDI (and this node becomes the primary for the service). Otherwise, it uses the stub retrieved from JNDI (stub to primary node's service EJB). This way, I expect that any node that uses the stub, invokes operation on the primary node's service POJO.
The problem is that, when I want to invoke a method from the primary node, everything works fine. But from other nodes, I get the correct stub object, but it's class name is not correct (e.g., when I get the stub in primary node, its hashcode is X and it's class name is Proxy101, but when I get the sub from another node, although the hashCode is still X, the calss name is Proxy103 on node B, Proxy 107 on node C, etc).
When I invoke a method on this hashcode, it seems that it's not invoked on the primary service POJO but on the local service POJO.
I'd appreciate any help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003057#4003057
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003057
19 years, 3 months
[JBoss Seam] - Re: Validation fails in registration example
by tvrtko
Again, I get the error.
Also, I tried changing Test case like this (I only shortened the password to three characters, and commented the following assert):
| public class RegisterTest extends SeamTest
| {
|
| @Test
| public void testLogin() throws Exception
| {
|
| new FacesRequest("/register.jspx") {
|
| @Override
| protected void processValidations() throws Exception
| {
| validateValue("#{user.username}", "1ovthafew");
| validateValue("#{user.name}", "Gavin King");
| validateValue("#{user.password}", "sec");
| //assert !isValidationFailure();
| }
|
If I run ant testexample, it fails with:
| FAILED: org.jboss.seam.example.registration.test.RegisterTest.testLogin()
| java.lang.NullPointerException
| at org.jboss.seam.core.Validation.validate(Validation.java:70)
| at org.jboss.seam.mock.SeamTest$Request.validateValue(SeamTest.java:372)
| at org.jboss.seam.example.registration.test.RegisterTest$1.processValidations(RegisterTest.java:21)
| at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:454)
| at org.jboss.seam.example.registration.test.RegisterTest.testLogin(RegisterTest.java:16)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:529)
| at org.testng.internal.Invoker.invokeMethod(Invoker.java:398)
| at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:625)
| at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:88)
| at org.testng.TestRunner.privateRun(TestRunner.java:614)
| at org.testng.TestRunner.run(TestRunner.java:505)
| at org.testng.SuiteRunner.privateRun(SuiteRunner.java:221)
| at org.testng.SuiteRunner.run(SuiteRunner.java:147)
| at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:576)
| at org.testng.TestNG.runSuitesLocally(TestNG.java:539)
| at org.testng.TestNG.run(TestNG.java:316)
| at org.testng.TestNG.privateMain(TestNG.java:666)
| at org.testng.TestNG.main(TestNG.java:608)
|
The offending line is:
| ClassValidator validator = getValidator( model.getClass(), componentName );
|
so I guess that model is null.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003056#4003056
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003056
19 years, 3 months