[EJB 3.0] - Re: NamingException: Could not dereference object - EJB 3.0
by vinu15378
I am facing the same problem of JNDI lookup in EJB 3.0 Entity Beans.
I am using Netbeans 5.5.1,JBoss 4.2.0 and standalone client.
I have checked everything.I didnt get where should we search for JNDI name to look up for bean.
Struggling hard for this example.
Please help for the same
Following is the Client Code.
package enterpriseapplication6;
import com.titan.travelagent.TravelAgentRemote;
import com.titan.domain.Cabin;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.Context;
public class Client
{
public static void main(String [] args)
{
try
{
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("travelagent.TransactionPersistenceContextRemote");
TravelAgentRemote dao = (TravelAgentRemote)ref;
Cabin cabin_1 = new Cabin();
cabin_1.setId(1);
cabin_1.setName("Master Suite");
cabin_1.setDeckLevel(1);
cabin_1.setShipId(1);
cabin_1.setBedCount(3);
dao.createCabin(cabin_1);
Cabin cabin_2 = dao.findCabin(1);
System.out.println(cabin_2.getName());
System.out.println(cabin_2.getDeckLevel());
System.out.println(cabin_2.getShipId());
System.out.println(cabin_2.getBedCount());
}
catch (javax.naming.NamingException ne)
{
ne.printStackTrace();
}
}
public static Context getInitialContext()
throws javax.naming.NamingException
{
Properties p = new Properties();
p.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(InitialContext.PROVIDER_URL,"jnp://localhost:1099");
InitialContext ctx = new InitialContext(p);
return new javax.naming.InitialContext();
}
}
Following error I am getting while executing Client Code.
I havent made any changes in Remote and Bean Class.
Please help me executing examples in EJB 3.0 Entity Bean Examples using
JBoss AS
javax.naming.NameNotFoundException: travelagent.TransactionPersistenceContextRemote not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
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:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at enterpriseapplication6.Client.main(Client.java:17)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156625#4156625
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4156625
17 years, 10 months
[Messaging, JMS & JBossMQ] - JMS Subsctiber not receiving message
by kks_krishna
Look into the following code. I am always getting message as null. why I am not able to receive the message?
| Properties props = new Properties();
| props.setProperty("java.naming.factory.initial",
| "org.jnp.interfaces.NamingContextFactory");
| props.setProperty("java.naming.factory.url.pkgs",
| "org.jboss.naming");
| props.setProperty("java.naming.provider.url", "localhost");
| Context context = new InitialContext(props);
| TopicConnectionFactory tcf = (TopicConnectionFactory) context
| .lookup("ConnectionFactory");
| conn = tcf.createTopicConnection();
| topic = (Topic) context.lookup("topic/BccTopic");
| session = conn.createTopicSession(false,
| TopicSession.AUTO_ACKNOWLEDGE);
| conn.start();
| TopicPublisher send = session.createPublisher(topic);
| TextMessage tm = session.createTextMessage("TestMessage");
| send.publish(tm);
| send.close();
|
| TopicSubscriber topicSubscriber = session.createSubscriber(topic);
| Message msg = topicSubscriber.receive(50);
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156624#4156624
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4156624
17 years, 10 months
[JBoss jBPM] - Error while trying to connect to Oracle database from jBPM
by b_sathish_1999
Hello,
I am trying to connect to an Oracle database from jBPM rather than the default in memory database. I have made the necessary configuration changes for that. I created a PAR file out of the process definition. I am trying to deploy the PAR file using the ant DeployProcessToServer task. When I run the build.xml, I get the following error :
Buildfile: C:\jBPMworkspace\jBPMFinTran\build.xml
deployProcess:
[echo] Deploy the process definition
[deployToServer] deploying par C:\jBPMworkspace\jBPMFinTran\processes\simple.par\simple.par ...
[deployToServer] java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8000/jbpm-console/upload[deployToServer] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
[deployToServer] at org.jbpm.ant.DeployProcessToServerTask.deployProcessWithServlet(DeployProcessToServerTask.java:164)
[deployToServer] at org.jbpm.ant.DeployProcessToServerTask.execute(DeployProcessToServerTask.java:99)
[deployToServer] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[deployToServer] at org.apache.tools.ant.Task.perform(Task.java:364)
[deployToServer] at org.apache.tools.ant.Target.execute(Target.java:341)
[deployToServer] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[deployToServer] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[deployToServer] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[deployToServer] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[deployToServer] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[deployToServer] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[deployToServer] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[deployToServer] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
BUILD FAILED
C:\jBPMworkspace\jBPMFinTran\build.xml:8: couldn't deploy process archives : Server returned HTTP response code: 500 for URL: http://localhost:8000/jbpm-console/upload
Also, when I start the server I get the following error :
15:02:44,390 ERROR [SessionFactoryImpl] Error in named query: GraphSession.findTokensForProcessInNode
org.hibernate.hql.ast.QuerySyntaxException: Invalid path: 'node.name' [
select token
from org.jbpm.graph.exe.Token token
where token.processInstance.processDefinition.name = :processDefinitionName
and node.name = :nodeName
]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:225)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:105)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:74)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:53)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:363)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:327)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:341)
at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:571)
at org.jbpm.JbpmContext.deployProcessDefinition(JbpmContext.java:173)
at org.jbpm.web.ProcessUploadServlet.handleRequest(ProcessUploadServlet.java:91)
at org.jbpm.web.ProcessUploadServlet.service(ProcessUploadServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Please let me know how to get rid of these errors and connect successfully to Oracle database from jBPM
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156622#4156622
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4156622
17 years, 10 months