[Installation, Configuration & Deployment] - Preventing startup on database/port in use error
by lduperval
Hi,
I am using JBoss 3.2.5 (which I cannot update for now, we're working on it).
Is it possible to prevent JBoss from starting if there is any problem which will prevent if from working correctly.
For example, if port 1098 or 1099 is already in use, JBoss will not work. Yet, I tested this by starting a first instance on a server, then starting another instance on the same server. The second instance gave a "address already in use" error, but the Java process was started nevertheless. I expected it to exit.
I also tried starting JBoss with no database server running. Once again, I saw a lot of errors, but the Java process remained. Then, after I started my database and tried to use my application, I received all sorts of failures.
Is it possible, in these two specific instances (and possibly others to determine later) to have JBoss close itself automatically?
I am running on Windows XP and JBoss is running as a service.
Thanks for your help,
L
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974570#3974570
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974570
19 years, 7 months
[Security & JAAS/JBoss] - NPE on SecurityActions.getContextClassLoader (Bug?)
by mskonda
Let me explain what I'm trying to do:
I have a resource adapter which does EIS specific stuff (it creates an Object, registers callbacks with a EIS written in C++ client using JNI, awaits for callbacks from the C++ EIS).
When the message arrrives, the C++ client invokes the callback on the same object. The object then submits the message to MessageEndpoint (MDB) fetched from the MessageEndpointFactory.
Currently (for testing purposes), the MDB's listener callback doesn't have any implementation except printing out that the message is received.
Now, when a message is arrived(that is, a callback is invoked from the C++ client), the enpoint is created (if not already created) and the listener message is invoked:
| endpointListener.onMessage(event);
|
I get a NullPointerException:
| 2006-09-27 12:54:23,643 TRACE [org.jboss.invocation.local.LocalInvoker] Failed to invoke on mbean: jboss.j2ee:jndiName=MyLocalFlowMDB,service=EJB
| java.lang.NullPointerException
| at org.jboss.ejb.Container.invoke(Container.java:825)
| 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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
| at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.run(LocalInvoker.java:144)
| at java.security.AccessController.doPrivileged(Native Method)
| at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:163)
| at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
| at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179)
| at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165)
| at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
| at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.delivery(MessageEndpointInterceptor.java:237)
| at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.invoke(MessageEndpointInterceptor.java:117)
| at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:59)
| at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
| at $Proxy61.onMessage(Unknown Source)
| at com.cmi2.pats.source.connector.PatsJNIWorker.patsPushEvent(PatsJNIWorker.java:303)
| at com.cmi2.pats.source.connector.PatsJNIWorker.testEvent(PatsJNIWorker.java:485)
| at com.cmi2.pats.source.connector.PatsJNIWorker.javaHandleEODEvent(PatsJNIWorker.java:412)
| 2006-09-27 12:54:23,643 TRACE [org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor] MessageEndpoint MyLocalFlowMDB@1 delivery error
|
When I dig the code, it seems that a method (invoke) in the org.jboss.ejb.Container.java is throwing this exception(see line decorated in red):
public Object invoke(Invocation mi)
| throws Exception
| {
| ClassLoader callerClassLoader = SecurityActions.getContextClassLoader();
| long start = System.currentTimeMillis();
| Method m = null;
|
| boolean setCl = false;
| Object type = null;
| String contextID = getJaccContextID();
| try
| {
| if (!callerClassLoader.equals(classLoader))
| {
| setCl = true;
| SecurityActions.setContextClassLoader(this.classLoader);
| }
|
When I debug the session, the callerClassLoader is null hence NPE when compared with the existing DelegatingClassLoader.
Interesting scenario is - when I send a test message(before the callback occurs on the Obejct from c++ client), it all works perfect (I found that the callerClassLoader is UCL3 during my debug session). However, when the message is obtained via callback, the callerClassLoader is null. (and hence falling flat over the equal block).
What is that I am doing wrong? I have tried using the java 2 securtiy manager and security.policy, but couldn't succeed.
However, when I did the following hack, it all went fine:
| // check whether the caller's cl is null to avoid NPE
| if (callerClassLoader != null)
| {
| if (!callerClassLoader.equals(classLoader))
| {
| setCl = true;
| SecurityActions.setContextClassLoader(this.classLoader);
| }
| }
| else
| {
| // caller's cl is null, hence set the delegating cl loader of this class
| setCl = true;
| SecurityActions.setContextClassLoader(this.classLoader);
| }
| ..
| }
|
I'll appreciate if anyone can throw somelight on this subject.
PS: I was not quite sure where to post this message to. Let me know if it's wrong forum.
Thanks
Madhu
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974566#3974566
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974566
19 years, 7 months
[Beginners Corner] - javax.naming.NameNotFoundException
by florian79
I am new in the world of EJB3. I deployed an .ear file to jboss 4.0.4.GA usin Hibernate Entity Manager
well, my SessionBean:
@Stateless
| public class BaseSession implements BaseSessionRemote
| {
|
| @PersistenceContext(unitName="dooris-portal") private EntityManager entityManager;
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#find(com.dooris.util.beans.AbstractBasicBean)
| */
| public BasicBean find(final Class classGot, final Long lIDGot)
| {
| return (BasicBean) this.entityManager.find(classGot, lIDGot);
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#merge(com.dooris.util.beans.AbstractBasicBean)
| */
| public BasicBean merge(BasicBean beanGot)
| {
| return (BasicBean) this.entityManager.merge(beanGot);
|
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#persiste(com.dooris.util.beans.AbstractBasicBean)
| */
| public void persiste(BasicBean beanGot)
| {
| this.entityManager.persist(beanGot);
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#findAll(java.lang.Class)
| */
| public Collection findAll(Class classGot)
| {
| return this.entityManager.createQuery("SELECT bean FROM " + classGot.getSimpleName()).getResultList();
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#getEntityManager()
| */
| public EntityManager getEntityManager()
| {
| return this.entityManager;
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#getLookupGroupByName()
| */
| public LookupGroup getLookupGroupByName(final String strNameGot)
| {
| return null;
| }
|
| }
and the Remote interface:
@Remote
| public interface BaseSessionRemote
| {
|
| public void persiste(final BasicBean beanGot);
| public BasicBean merge(final BasicBean beanGot);
| public BasicBean find(final Class classGot, final Long lIDGot);
| public Collection findAll(final Class classGot);
| public EntityManager getEntityManager();
| public LookupGroup getLookupGroupByName(final String strNameGot);
| public User findUserByEmailAndPassword(final String strEmailGot, final String strPasswordGot);
| }
My persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
| <persistence-unit name="dooris-portal" transaction-type="JTA">
| <!-- java:/doorisPortalDB doorisPortalDB -->
| <jta-data-source>java:/doorisPortalDB</jta-data-source>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
| <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
| </properties>
| </persistence-unit>
| </persistence>
And the Exception:
15:26:55,007 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
| 15:26:55,217 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
| 15:26:55,638 INFO [TomcatDeployer] deploy, ctxPath=/loom-portal, warUrl=.../deploy/loom-portal.war/
| 15:26:55,878 INFO [WebappClassLoader] validateJarFile(D:\jboss-4.0.4.GA\server\dooris\.\deploy\loom-portal.war\WEB-INF\lib\javaee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
| 15:26:55,888 INFO [WebappClassLoader] validateJarFile(D:\jboss-4.0.4.GA\server\dooris\.\deploy\loom-portal.war\WEB-INF\lib\javax.servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
| 15:26:57,941 INFO [STDOUT] [2006.09.27][com.dooris.util.hibernate.EJBUtil][BaseSession not bound][FATAL]:
| 15:26:57,941 ERROR [STDERR] javax.naming.NameNotFoundException: BaseSession not bound
| 15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| 15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| 15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| 15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
| 15:26:57,941 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
| 15:26:57,941 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
| 15:26:57,941 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
| 15:26:57,941 ERROR [STDERR] at com.dooris.util.hibernate.EJBUtil.createBaseSession(EJBUtil.java:34)
what is wrong on my code or what is wrong with my jboss configuration?
Thank you in advance!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974550#3974550
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974550
19 years, 7 months
[JNDI/Naming/Network] - javax.naming.NameNotFoundException
by florian79
I am new in the world of EJB3. I deployed an .ear file to jboss 4.0.4.GA usin Hibernate Entity Manager
well, my SessionBean:
@Stateless
| public class BaseSession implements BaseSessionRemote
| {
|
| @PersistenceContext(unitName="dooris-portal") private EntityManager entityManager;
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#find(com.dooris.util.beans.AbstractBasicBean)
| */
| public BasicBean find(final Class classGot, final Long lIDGot)
| {
| return (BasicBean) this.entityManager.find(classGot, lIDGot);
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#merge(com.dooris.util.beans.AbstractBasicBean)
| */
| public BasicBean merge(BasicBean beanGot)
| {
| return (BasicBean) this.entityManager.merge(beanGot);
|
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#persiste(com.dooris.util.beans.AbstractBasicBean)
| */
| public void persiste(BasicBean beanGot)
| {
| this.entityManager.persist(beanGot);
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#findAll(java.lang.Class)
| */
| public Collection findAll(Class classGot)
| {
| return this.entityManager.createQuery("SELECT bean FROM " + classGot.getSimpleName()).getResultList();
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#getEntityManager()
| */
| public EntityManager getEntityManager()
| {
| return this.entityManager;
| }
|
| /* (non-Javadoc)
| * @see com.dooris.util.hibernate.BaseSessionRemote#getLookupGroupByName()
| */
| public LookupGroup getLookupGroupByName(final String strNameGot)
| {
| return null;
| }
|
| }
and the Remote interface:
@Remote
| public interface BaseSessionRemote
| {
|
| public void persiste(final BasicBean beanGot);
| public BasicBean merge(final BasicBean beanGot);
| public BasicBean find(final Class classGot, final Long lIDGot);
| public Collection findAll(final Class classGot);
| public EntityManager getEntityManager();
| public LookupGroup getLookupGroupByName(final String strNameGot);
| public User findUserByEmailAndPassword(final String strEmailGot, final String strPasswordGot);
| }
My persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
| <persistence-unit name="dooris-portal" transaction-type="JTA">
| <!-- java:/doorisPortalDB doorisPortalDB -->
| <jta-data-source>java:/doorisPortalDB</jta-data-source>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
| <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
| </properties>
| </persistence-unit>
| </persistence>
And the Exception:
15:26:55,007 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
| 15:26:55,217 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
| 15:26:55,638 INFO [TomcatDeployer] deploy, ctxPath=/loom-portal, warUrl=.../deploy/loom-portal.war/
| 15:26:55,878 INFO [WebappClassLoader] validateJarFile(D:\jboss-4.0.4.GA\server\dooris\.\deploy\loom-portal.war\WEB-INF\lib\javaee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
| 15:26:55,888 INFO [WebappClassLoader] validateJarFile(D:\jboss-4.0.4.GA\server\dooris\.\deploy\loom-portal.war\WEB-INF\lib\javax.servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
| 15:26:57,941 INFO [STDOUT] [2006.09.27][com.dooris.util.hibernate.EJBUtil][BaseSession not bound][FATAL]:
| 15:26:57,941 ERROR [STDERR] javax.naming.NameNotFoundException: BaseSession not bound
| 15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| 15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| 15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| 15:26:57,941 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
| 15:26:57,941 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
| 15:26:57,941 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
| 15:26:57,941 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
| 15:26:57,941 ERROR [STDERR] at com.dooris.util.hibernate.EJBUtil.createBaseSession(EJBUtil.java:34)
what is wrong on my code or what is wrong with my jboss configuration?
Thank you in advance!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974549#3974549
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974549
19 years, 7 months