[EJB/JBoss] - Queer error: java.lang.LinkageError: loader constraints viol
by Subhash.Bhushan
Hi,
I faced a queer error with JBoss 4.2.2 GA, so thought of reporting it even though I managed to circumvent the problem.
I have a stateless EJB LoginBean, with remote interface Login:
Remote Interface:
package com.justbooks.security;
|
| import javax.ejb.Remote;
|
| import com.justbooks.entities.Profile;
|
| @Remote
| public interface Login {
| public boolean signOn(Profile profile);
| public boolean signOn(String loginName, String loginPassword);
| }
|
Bean Class:
| package com.justbooks.security;
|
| import javax.ejb.Stateless;
|
| import com.justbooks.entities.Profile;
| import com.justbooks.security.Login;
| import javax.persistence.*;
| import com.justbooks.utility.*;
|
| public @Stateless class LoginBean implements Login
|
I have a DAO Stateless EJB called ProfileDAOBean, with remote interface ProfileDAO:
Remote Interface:
package com.justbooks.dao;
|
| import javax.ejb.Remote;
|
| import com.justbooks.entities.Profile;
|
| @Remote
| public interface ProfileDAO {
| public Profile findProfile(String loginName);
| public boolean authenticate(String loginName, String loginPassword);
| public boolean changePassword(String loginName, String oldPassword,
| String newPassword);
|
| }
|
Bean Class:
| package com.justbooks.dao;
|
| import javax.naming.Context;
| import javax.naming.NamingException;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import javax.persistence.Query;
| import javax.ejb.Stateless;
|
| import com.justbooks.utility.EJBFinder;
| import com.justbooks.entities.Profile;
| import com.justbooks.security.ChangePassword;
| import com.justbooks.security.Login;
|
| public @Stateless class ProfileDAOBean implements ProfileDAO
|
If I include the lookup code for LoginBean inside ProfileDAOBean, then the application works just fine. But if I use a helper class to find EJBs, my application throws up an error saying anonymous wrote : 15:01:57,890 ERROR [[default]] Servlet.service() for servlet default threw exception
| java.lang.LinkageError: loader constraints violated when linking com/justbooks/security/Login class
EJBHelper:
package com.justbooks.utility;
|
| import javax.naming.Context;
| import javax.naming.NamingException;
|
| import com.justbooks.security.ChangePassword;
| import com.justbooks.security.Login;
|
| public final class EJBHelper {
| private static Context getInitialContext()
| throws javax.naming.NamingException
| {
| return new javax.naming.InitialContext();
| }
|
| public static Login getLoginEJB() {
| try {
| Context jndiContext = getInitialContext();
| //TODO put these lookup strings in properties file
| Object ref = jndiContext.lookup("JustAutomate/LoginBean/remote");
| Login login = (Login)ref;
| return login;
| }catch (NamingException ne) {
| ne.printStackTrace();
| return null;
| }
| }
|
| public static ChangePassword getChangePasswordEJB() {
| try {
| Context jndiContext = getInitialContext();
| //TODO put these lookup strings in properties file
| Object ref = jndiContext.lookup("JustAutomate/ChangePasswordBean/remote");
| ChangePassword changePassword = (ChangePassword)ref;
| return changePassword;
| }catch (NamingException ne) {
| ne.printStackTrace();
| return null;
| }
| }
| }
If I change the name of the class to EJBFinder, then everything starts working fine again. Not sure what the problem is.
As of now, I have circumvented the problem by renaming the class from EJBHelper to EJBFinder.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133816#4133816
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133816
18 years, 1 month
[Tomcat, HTTPD, Servlets & JSP] - jsf pluggable pages?
by Deady
I have jsf application, written using facelets. I want it to be extedable with custom modules.
Module is simple jar with faces-context.xml in it. I can place it in /WEB-INF/lib directory, register somehow in my app, for example by specifying main class of module, so later, after deploy, I can reach all resources from this jar.
As specified in spec, I can add managed beans and custom navigation rules into module's faces-context.xml. But what about jsp pages? How can I add them and later tell my main app to use them? For example, I have rule:
<navigation-rule>
| <from-view-id>/modules/test/foo.jsp</from-view-id>
| <navigation-case>
| <from-action>#{moduleBean.doSmth}</from-action>
| <to-view-id>/modules/test/foo1.jsp</to-view-id>
| </navigation-case>
| </navigation-rule>
(let's say, that every module must use /modules/<module_name> prefix). Both foo.jsp and foo1.jsp are located in module_test.jar, which is (as Imentioned before) in /WEB-INF/lib folder of my main app. So how will main app understand that it must load jsp's from module_test.jar?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133810#4133810
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133810
18 years, 1 month