This content has been marked as final.
Show 6 replies
-
1. Re: JBoss 5.0.0.CR1, @LocalBinding
jaikiran Sep 9, 2008 5:23 AM (in response to gla-001)Works for me in CR1 as well as Beta. Please post your entire EJB code along with the import statements. Also post the JNDI tree contents by following the steps mentioned at http://wiki.jboss.org/wiki/DisplayTheJDNITreeWithTheJMXConsole
-
2. Re: JBoss 5.0.0.CR1, @LocalBinding
gla-001 Sep 9, 2008 5:46 AM (in response to gla-001)JNDI View:
Other components with java:comp namespace
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=CategoryManagerBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=SearchManagerBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=ArticleCacheManagerBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=SearchResourcesBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=UserManagerBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=WebObjManagerBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=OrderManagerBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=WebstageCacheMgrBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=AbstractSessionBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=CacheManagerBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=OISManagerBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java:comp namespace of the component jboss.j2ee:ear=xyz.ear,jar=xyz-ejb-beans.jar,name=AssistManagerBean,service=EJB3 :
+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
+- EJBContext (class: javax.ejb.EJBContext)
+- env (class: org.jnp.interfaces.NamingContext)
java: Namespace
+- securityManagement (class: org.jboss.security.integration.JNDIBasedSecurityManagement)
+- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
+- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)
+- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
+- comp (class: javax.namingMain.Context)
+- jaas (class: javax.naming.Context)
| +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
+- timedCacheFactory (class: javax.naming.Context)
Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
+- TransactionPropagationContextExporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- Mail (class: javax.mail.Session)
+- TransactionPropagationContextImporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- policyRegistration (class: org.jboss.security.plugins.JBossPolicyRegistration)
+- xyz4 (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- TransactionManager (class: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate)
Global JNDI Namespace
+- UserTransactionSessionFactory (proxy: $Proxy89 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
+- console (class: org.jnp.interfaces.NamingContext)
| +- PluginManager (proxy: $Proxy87 implements interface org.jboss.console.manager.PluginManagerMBean)
+- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
+- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
+- jmx (class: org.jnp.interfaces.NamingContext)
| +- invoker (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor (proxy: $Proxy86 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
| +- rmi (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
+- TomcatAuthenticators (class: java.util.Properties)
+- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
A bean looks like this:@Stateless @Pool (value="StrictMaxPool", maxSize=1) @LocalBinding (jndiBinding="server.configurationMgr.interfaces.ConfigurationManagerLocal") @RemoteBinding (jndiBinding="server.configurationMgr.interfaces.ConfigurationManagerRemote") public class ConfigurationManagerBean implements ConfigurationManagerLocal, ConfigurationManagerRemote { private Properties configuration; private Properties defaultConfiguration; ...
The interfaces:@Local public interface ConfigurationManagerLocal extends ConfigurationManagerDefinition{ ....
@Remote public interface ConfigurationManagerRemote extends ConfigurationManagerDefinition { ...
-
3. Re: JBoss 5.0.0.CR1, @LocalBinding
jaikiran Sep 9, 2008 5:54 AM (in response to gla-001)"jaikiran" wrote:
Please post your entire EJB code along with the import statements.
Please post the import statements, in your EJB code, too.
Also, post the console logs of JBoss server. The DEBUG level logs in the server.log from the point when your application is being deployed, will also help. -
4. Re: JBoss 5.0.0.CR1, @LocalBinding
gla-001 Sep 9, 2008 6:19 AM (in response to gla-001)Oh sorry! It's quite basic stuff in this bean:
package com.abc.server.configurationMgr.bean; import his.base.Category; import his.base.DBIdList; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Enumeration; import java.util.Properties; import java.util.StringTokenizer; import java.util.Vector; import javax.annotation.PostConstruct; import javax.ejb.EJBException; import javax.ejb.SessionContext; import javax.ejb.Stateless; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; import org.jboss.ejb3.annotation.LocalBinding; import org.jboss.ejb3.annotation.Pool; import org.jboss.ejb3.annotation.RemoteBinding; import com.abc.base.Trace; import com.abc.base.Util; import com.abc.server.configurationMgr.ConfigurationDB; import com.abc.server.configurationMgr.interfaces.ConfigurationManagerDefinition; import com.abc.server.configurationMgr.interfaces.ConfigurationManagerLocal; import com.abc.server.configurationMgr.interfaces.ConfigurationManagerRemote; public class ConfigurationManagerBean implements ConfigurationManagerLocal, ConfigurationManagerRemote { private Properties configuration; private Properties defaultConfiguration; private transient InitialContext namingContext; private DataSource datasource; @PostConstruct public void ejbCreate() { try { namingContext = new InitialContext(); } catch (NamingException e) { throw new EJBException(e); } initDefaultconfiguration(); try { namingContext.lookup("java:comp/env/jdbc/XY"); datasource = (DataSource) namingContext.lookup("java:XY4"); Connection connection = datasource.getConnection(); DatabaseMetaData dmd = connection.getMetaData(); } catch (Exception e) { trc.error("Cannot load Datasource!"); Trace.error(e); } try { load(); } catch (Exception e) { throw new EJBException(e); } } public void ejbActivate() throws EJBException { try { namingContext = new InitialContext(); } catch (NamingException e) { throw new EJBException(e); } } public void ejbPassivate() throws EJBException { datasource = null; } public void ejbRemove() throws EJBException { Trace.info(tXY, "ejbRemove: ConfigurationManagerBean"); } public void setSessionContext(SessionContext arg0) throws EJBException { } public DataSource getConnectionPool() { return datasource; } public DataSource getDataSource() /*throws Exception */ { return datasource; } public int getInt(String key, int defaultValue) { String strValue = configuration.getProperty(key); if (strValue == null) { return defaultValue; } else { Integer i = new Integer(strValue); return i.intValue(); } } public DBIdList getIntList(String key, DBIdList defaultValue) { String strValue = configuration.getProperty(key); if (strValue == null) { return defaultValue; } DBIdList result = new DBIdList(); StringTokenizer tokenizer = new StringTokenizer(strValue, ","); while (tokenizer.hasMoreTokens()) { try { result.add(new Integer(tokenizer.nextToken().trim())); } catch (Exception e) { System.out.println("Value \"" + strValue + "\" for key \"" + key + "\" could not parsed! (exception: " + e.getMessage() + ")"); return defaultValue; } } return result; } public Vector getStringList(String key, Vector defaultValue) { String strValue = configuration.getProperty(key); if (strValue == null) { return defaultValue; } Vector result = new Vector(); StringTokenizer tokenizer = new StringTokenizer(strValue, ","); while (tokenizer.hasMoreTokens()) { result.add(tokenizer.nextToken().trim()); } return result; } public String getString(String key, String defaultValue) { String strValue = configuration.getProperty(key); if (strValue == null) { strValue = defaultValue; } return strValue; } public boolean getBoolean(String key, boolean defaultValue) { String strValue = configuration.getProperty(key); if (strValue == null) return defaultValue; strValue = strValue.toLowerCase(); if (strValue.charAt(0) == 't' || strValue.charAt(0) == '1' || strValue.charAt(0) == 'y' || strValue.charAt(0) == 'j') return true; if (strValue.charAt(0) == 'f' || strValue.charAt(0) == '0' || strValue.charAt(0) == 'n') return false; return defaultValue; } public Properties load() /*throws RemoteException*/ { try { Properties conf = new Properties(defaultConfiguration); Connection connection = datasource.getConnection(); Properties newConfiguration = ConfigurationDB.load(connection); for (Enumeration enumeration = newConfiguration.propertyNames(); enumeration.hasMoreElements();) { String key = (String) enumeration.nextElement(); String value = newConfiguration.getProperty(key); conf.setProperty(key, Util.notNULL(value)); } configuration = conf; // nur wenn die Konfiguration erfolgreich geladen werden konnte! connection.close(); } catch (SQLException e) { Trace.error("Problems encountered during closing the connection!", e); } return configuration; } public void save(Properties config) { try { Connection connection = datasource.getConnection(); ConfigurationDB.save(connection, config); configuration = new Properties(defaultConfiguration); for (Enumeration enumeration = config.propertyNames(); enumeration.hasMoreElements();) { String key = (String) enumeration.nextElement(); String value = config.getProperty(key); configuration.setProperty(key, Util.notNULL(value)); } connection.close(); } catch (Exception e) { Trace.error(e); } } public Properties getProperties() { return new Properties(configuration); } private String getStringEnvEntry(String name) { String envEntry = null; try { envEntry = (String) namingContext.lookup(name); } catch (NamingException e) { throw new EJBException(e); } return envEntry; } private int getIntEnvEntry(String name) { Integer envEntry = null; try { envEntry = (Integer) namingContext.lookup(name); } catch (NamingException e) { throw new EJBException(e); } if (envEntry != null) { return envEntry.intValue(); } else { return 0; } } private boolean getBooleanEnvEntry(String name) { Boolean envEntry; try { envEntry = (Boolean) namingContext.lookup(name); } catch (NamingException e) { throw new EJBException(e); } if (envEntry != null) { return envEntry.booleanValue(); } else { return false; } } private void initDefaultconfiguration() { defaultConfiguration = new Properties(); defaultConfiguration.setProperty(ConfigurationManagerDefinition.GLOBAL_RELOADPROPERTIESTIMEOUT, "180"); } }
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) installing bean: jboss.j2ee:ear=ringfoto.ear,jar=ringfoto-ejb-beans.jar,name=ConfigurationManagerBean,service=EJB3
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) with dependencies:
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) and demands:
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) jboss.ejb:service=EJBTimerService
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) and supplies:
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) jndi:ringfoto/ConfigurationManagerBean/remote
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) jndi:ConfigurationManagerBean
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) jndi:ringfoto/ConfigurationManagerBean/local
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) jndi:ringfoto/ConfigurationManagerBean/remote-com.dept101.server.configurationMgr.interfaces.ConfigurationManagerRemote
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) Class:com.dept101.server.configurationMgr.interfaces.ConfigurationManagerRemote
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) Class:com.dept101.server.configurationMgr.interfaces.ConfigurationManagerLocal
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) jndi:ringfoto/ConfigurationManagerBean/local-com.dept101.server.configurationMgr.interfaces.ConfigurationManagerLocal
2008-09-09 12:18:03,375 INFO [org.jboss.ejb3.deployers.JBossASKernel] (main) Added bean(jboss.j2ee:ear=ringfoto.ear,jar=ringfoto-ejb-beans.jar,name=ConfigurationManagerBean,service=EJB3) to KernelDeployment of: ringfoto-ejb-beans.jar
2008-09-09 12:18:03,375 DEBUG [org.jboss.ejb3.Ejb3Deployment] (main) Bound ejb3 container jboss.j2ee:ear=ringfoto.ear,jar=ringfoto-ejb-beans.jar,name=ConfigurationManagerBean,service=EJB3 -
5. Re: JBoss 5.0.0.CR1, @LocalBinding
jaikiran Sep 9, 2008 7:07 AM (in response to gla-001)import org.jboss.ejb3.annotation.LocalBinding;
import org.jboss.ejb3.annotation.RemoteBinding;
The reason i asked for the import statements is because there was a change in the package for the RemoteBinding and LocalBinding annotations in JBoss-5. So just wanted to make sure that you are using the correct ones. You are using the correct ones.public class ConfigurationManagerBean
implements ConfigurationManagerLocal, ConfigurationManagerRemote {
private Properties configuration;
private Properties defaultConfiguration;
private transient InitialContext namingContext;
I don't see any annotations like @Stateless and @LocalBinding on this class. I assume that you left it out from this post because you already provided it once in your earlier post.
Can you post a few more lines from the server.log? I am interested in something like (UserManagerBean is a EJB on my setup) :2008-09-09 14:32:21,322 INFO [org.jboss.ejb3.EJBContainer] (main) STARTED EJB: org.myapp.ejb.impl.UserManagerBean ejbName: UserManagerBean 2008-09-09 14:32:21,369 DEBUG [org.jboss.ejb3.proxy.factory.ProxyFactoryHelper] (main) Obtaining JNDI name from policy org.jboss.ejb3.jndipolicy.impl.PackagingBasedJndiBindingPolicy 2008-09-09 14:32:21,369 DEBUG [org.jboss.ejb3.proxy.factory.ProxyFactoryHelper] (main) Obtaining JNDI name from policy org.jboss.ejb3.jndipolicy.impl.PackagingBasedJndiBindingPolicy 2008-09-09 14:32:21,416 DEBUG [org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory] (main) Binding proxy for UserManagerBean in JNDI at RemoteUserManagerBean 2008-09-09 14:32:21,447 DEBUG [org.jboss.ejb3.proxy.factory.ProxyFactoryHelper] (main) Obtaining JNDI name from policy org.jboss.ejb3.jndipolicy.impl.PackagingBasedJndiBindingPolicy 2008-09-09 14:32:21,447 DEBUG [org.jboss.ejb3.proxy.factory.ProxyFactoryHelper] (main) Obtaining JNDI name from policy org.jboss.ejb3.jndipolicy.impl.PackagingBasedJndiBindingPolicy 2008-09-09 14:32:21,447 DEBUG [org.jboss.ejb3.proxy.factory.BaseSessionProxyFactory] (main) Binding proxy for UserManagerBean in JNDI at LocalUserManagerBean
-
6. Re: JBoss 5.0.0.CR1, @LocalBinding
gla-001 Sep 9, 2008 7:40 AM (in response to gla-001)Thanks for your help jaikiran, but i was wrong. The problem isn't an incorrect binding as i assumed. The EJB is simply stopped after the deployment... Sorry for that! It was a missinterpretation of the log files