Hello folks!
I have started learning EJB 3.0+ and I have written very few lines of code from O'Reilly book which originaly was written for JBoss 4.0 however I decided to run examples on JBoss 7.
So here is my problem, I got SocketTimeoutException while I try downloading some simple entity bean. I know its not very detailed information however there might be something wrong with my JNDI InitialContext object, because when I list all of the ports in my system (Debian 2.6) with netstat -na there is none with 1099 port.
I use standalone-full configuration with following changes:
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jta="false" jndi-name="java:jboss/datasources/TestDS" pool-name="TestDS" enabled="true" use-java-context="true" use-ccm="false">
<connection-url>jdbc:mysql://localhost:3306/TitanDB</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>
</drivers>
</datasources>
</subsystem>
Mysql connector is well configured and I do not have any errors in my jboss log file:
22:42:15,162 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies.jar"
22:42:15,543 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for titan
22:42:15,746 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named CalculatorBean in deployment unit deployment "EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies.jar" are as follows:
java:global/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/CalculatorBean!com.titan.travelagent.CalculatorRemote
java:app/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/CalculatorBean!com.titan.travelagent.CalculatorRemote
java:module/CalculatorBean!com.titan.travelagent.CalculatorRemote
java:jboss/exported/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/CalculatorBean!com.titan.travelagent.CalculatorRemote
java:global/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/CalculatorBean
java:app/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/CalculatorBean
java:module/CalculatorBean
22:42:15,751 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named TravelAgentBean in deployment unit deployment "EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies.jar" are as follows:
java:global/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/TravelAgentBean!com.titan.travelagent.TravelAgentRemote
java:app/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/TravelAgentBean!com.titan.travelagent.TravelAgentRemote
java:module/TravelAgentBean!com.titan.travelagent.TravelAgentRemote
java:jboss/exported/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/TravelAgentBean!com.titan.travelagent.TravelAgentRemote
java:global/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/TravelAgentBean
java:app/EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies/TravelAgentBean
java:module/TravelAgentBean
22:42:16,167 INFO [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011402: Starting Persistence Unit Service 'EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies.jar#titan'
22:42:16,490 INFO [org.hibernate.annotations.common.Version] (MSC service thread 1-1) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
22:42:16,499 INFO [org.hibernate.Version] (MSC service thread 1-1) HHH000412: Hibernate Core {4.0.1.Final}
22:42:16,503 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-1) HHH000206: hibernate.properties not found
22:42:16,506 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-1) HHH000021: Bytecode provider name : javassist
22:42:16,577 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-1) HHH000204: Processing PersistenceUnitInfo [
name: titan
...]
22:42:16,924 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-1) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
22:42:17,742 INFO [org.hibernate.dialect.Dialect] (MSC service thread 1-1) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
22:42:17,781 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-1) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
22:42:17,796 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-1) HHH000397: Using ASTQueryTranslatorFactory
22:42:17,935 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-1) Hibernate Validator 4.2.0.Final
22:42:18,664 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "EJB-Server-0.0.1-SNAPSHOT-jar-with-dependencies.jar"
I even tried to lookup for names listed in logs however it has no goal.
Client application:
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("TravelAgentBean/remote");
TravelAgentRemote dao = (TravelAgentRemote) PortableRemoteObject.narrow(ref, TravelAgentRemote.class);
...
public static Context getInitialContext() throws NamingException {
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming");
env.setProperty(Context.PROVIDER_URL, "localhost:1099");
return new InitialContext(env);
}
I would appreciate for any hints or tips! Cheers!
Comments