Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ejb example issues

Posted on 2017-01-30
3
Medium Priority
?
220 Views
Last Modified: 2017-03-20
Hi,

I am trying below example

https://eai-course.blogspot.com/2012/10/a-simple-enterprise-javabeans-31.html?showComment=1485835540336#c1455637229426997062

This is the jndi.properties file. Note that you should change the username and password to match your own case. This file sets the behavior of the InitialContext object we create in the main() method. E.g., it will tell how to create the JNDI client, where is the server (machine and port), etc.:


java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.provider.url=http-remoting://localhost:8080
jboss.naming.client.ejb.context=true
i was not clear what is src though to add jndi.properties.
my project structure as attached
I did everything as it is i am getting below error

Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
      at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
      at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
      at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at javax.naming.InitialContext.doLookup(Unknown Source)
      at ejbs.PlayAddBean.main(PlayAddBean.java:15)


wheni deploy project to wildfly 10 server generating below jndi references



21:40:25,035 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.2.Final
21:40:27,463 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
21:40:27,706 INFO  [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) starting
21:40:36,745 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found GreetEJBProjectStaless.jar in deployment directory. To trigger deployment create a file called GreetEJBProjectStaless.jar.dodeploy
21:40:36,746 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found HelloStatelessEJB.jar in deployment directory. To trigger deployment create a file called HelloStatelessEJB.jar.dodeploy
21:40:36,873 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
21:40:36,948 INFO  [org.xnio] (MSC service thread 1-6) XNIO version 3.4.0.Final
21:40:36,959 INFO  [org.xnio.nio] (MSC service thread 1-6) XNIO NIO Implementation Version 3.4.0.Final
21:40:37,110 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
21:40:37,116 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
21:40:37,131 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
21:40:37,136 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
21:40:37,142 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
21:40:37,155 INFO  [org.jboss.as.security] (MSC service thread 1-5) WFLYSEC0001: Current PicketBox version=4.9.6.Final
21:40:37,174 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
21:40:37,180 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
21:40:37,298 INFO  [org.jboss.as.connector] (MSC service thread 1-5) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.4.Final)
21:40:37,772 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
21:40:37,783 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0018: Started Driver service with driver-name = h2
21:40:37,832 INFO  [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service
21:40:37,832 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-4) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
21:40:38,422 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0003: Undertow 1.4.0.Final starting
21:40:38,759 INFO  [org.jboss.remoting] (MSC service thread 1-4) JBoss Remoting version 4.0.21.Final
21:40:39,007 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path 'C:\gpSoftwares\wildfly-10.1.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
21:40:39,150 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0012: Started server default-server.
21:40:39,152 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0018: Host default-host starting
21:40:39,540 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 64 (per class), which is derived from thread worker pool sizing.
21:40:39,541 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 16 (per class), which is derived from the number of CPUs on this host.
21:40:39,770 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8180
21:40:39,898 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
21:40:40,358 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-2) WFLYDM0111: Keystore C:\gpSoftwares\wildfly-10.1.0.Final\standalone\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
21:40:40,428 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) WFLYDS0013: Started FileSystemDeploymentService for directory C:\gpSoftwares\wildfly-10.1.0.Final\standalone\deployments
21:40:40,440 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "HelloStatelessEJB.jar" (runtime-name: "HelloStatelessEJB.jar")
21:40:40,441 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "GreetEJBProjectStaless.jar" (runtime-name: "GreetEJBProjectStaless.jar")
21:40:40,934 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8543
21:40:41,230 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-8) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.4.Final
21:40:41,468 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 64) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
21:40:41,469 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 65) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
21:40:41,470 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 65) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
21:40:41,470 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 64) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
21:40:41,477 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 58) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
21:40:41,490 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 58) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
21:40:42,981 INFO  [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBossWS 5.1.5.Final (Apache CXF 3.1.6)
21:40:43,902 INFO  [org.jboss.weld.deployer] (MSC service thread 1-8) WFLYWELD0003: Processing weld deployment HelloStatelessEJB.jar
21:40:43,970 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0003: Processing weld deployment GreetEJBProjectStaless.jar
21:40:45,094 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-4) HV000001: Hibernate Validator 5.2.4.Final
21:40:45,230 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-8) WFLYEJB0473: JNDI bindings for session bean named 'SLBean' in deployment unit 'deployment "HelloStatelessEJB.jar"' are as follows:

      java:global/HelloStatelessEJB/SLBean!com.example.ejbtest.SLBeanRemote
      java:app/HelloStatelessEJB/SLBean!com.example.ejbtest.SLBeanRemote
      java:module/SLBean!com.example.ejbtest.SLBeanRemote
      java:jboss/exported/HelloStatelessEJB/SLBean!com.example.ejbtest.SLBeanRemote
      java:global/HelloStatelessEJB/SLBean
      java:app/HelloStatelessEJB/SLBean
      java:module/SLBean

21:40:45,230 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-4) WFLYEJB0473: JNDI bindings for session bean named 'GreetBean' in deployment unit 'deployment "GreetEJBProjectStaless.jar"' are as follows:

      java:global/GreetEJBProjectStaless/GreetBean!com.gp.GreetBeanRemote
      java:app/GreetEJBProjectStaless/GreetBean!com.gp.GreetBeanRemote
      java:module/GreetBean!com.gp.GreetBeanRemote
      java:jboss/exported/GreetEJBProjectStaless/GreetBean!com.gp.GreetBeanRemote
      java:global/GreetEJBProjectStaless/GreetBean!com.gp.GreetBean
      java:app/GreetEJBProjectStaless/GreetBean!com.gp.GreetBean
      java:module/GreetBean!com.gp.GreetBean

21:40:45,527 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 58) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
21:40:45,530 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 58) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
21:40:45,739 INFO  [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900: 2.3.5 (Final)
21:40:47,353 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 58) WFLYCLINF0002: Started client-mappings cache from ejb container
21:40:48,670 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "HelloStatelessEJB.jar" (runtime-name : "HelloStatelessEJB.jar")
21:40:48,671 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "GreetEJBProjectStaless.jar" (runtime-name : "GreetEJBProjectStaless.jar")
21:40:49,255 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:10090/management
21:40:49,257 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:10090
21:40:49,257 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 26732ms - Started 500 of 743 services (409 services are lazy, passive or on-demand)
22:51:52,588 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found ejb-remote-server.jar in deployment directory. To trigger deployment create a file called ejb-remote-server.jar.dodeploy
22:51:53,597 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0028: Stopped deployment GreetEJBProjectStaless.jar (runtime-name: GreetEJBProjectStaless.jar) in 823ms
22:51:53,776 WARN  [org.jboss.as.controller] (DeploymentScanner-threads - 2) WFLYCTL0357: Notification of type deployment-undeployed is not described for the resource at the address []
22:51:53,778 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0009: Undeployed "GreetEJBProjectStaless.jar" (runtime-name: "GreetEJBProjectStaless.jar")
22:51:58,796 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "ejb-remote-server.jar" (runtime-name: "ejb-remote-server.jar")
22:51:58,833 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) WFLYWELD0003: Processing weld deployment ejb-remote-server.jar
22:51:58,842 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-7) WFLYEJB0473: JNDI bindings for session bean named 'ExampleServiceImpl' in deployment unit 'deployment "ejb-remote-server.jar"' are as follows:

      java:global/ejb-remote-server/ExampleServiceImpl!com.gp.GreetBeanRemote
      java:app/ejb-remote-server/ExampleServiceImpl!com.gp.GreetBeanRemote
      java:module/ExampleServiceImpl!com.gp.GreetBeanRemote
      java:jboss/exported/ejb-remote-server/ExampleServiceImpl!com.gp.GreetBeanRemote
      java:global/ejb-remote-server/ExampleServiceImpl!com.gp.ExampleServiceImpl
      java:app/ejb-remote-server/ExampleServiceImpl!com.gp.ExampleServiceImpl
      java:module/ExampleServiceImpl!com.gp.ExampleServiceImpl

22:51:59,074 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0010: Deployed "ejb-remote-server.jar" (runtime-name : "ejb-remote-server.jar")
23:00:54,454 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) WFLYDS0004: Found EJB-Add.jar in deployment directory. To trigger deployment create a file called EJB-Add.jar.dodeploy
23:00:54,458 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "EJB-Add.jar" (runtime-name: "EJB-Add.jar")
23:00:54,474 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0003: Processing weld deployment EJB-Add.jar
23:00:54,481 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-4) WFLYEJB0473: JNDI bindings for session bean named 'AddBean' in deployment unit 'deployment "EJB-Add.jar"' are as follows:

      java:global/EJB-Add/AddBean!ejbs.AddBeanRemote
      java:app/EJB-Add/AddBean!ejbs.AddBeanRemote
      java:module/AddBean!ejbs.AddBeanRemote
      java:jboss/exported/EJB-Add/AddBean!ejbs.AddBeanRemote
      java:global/EJB-Add/AddBean
      java:app/EJB-Add/AddBean
      java:module/AddBean

23:00:54,700 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "EJB-Add.jar" (runtime-name : "EJB-Add.jar")
23:07:05,006 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0028: Stopped deployment EJB-Add.jar (runtime-name: EJB-Add.jar) in 20ms
23:07:05,028 WARN  [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0357: Notification of type deployment-undeployed is not described for the resource at the address []
23:07:05,029 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0009: Undeployed "EJB-Add.jar" (runtime-name: "EJB-Add.jar")
23:07:15,041 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) WFLYDS0004: Found EJB-Add.jar in deployment directory. To trigger deployment create a file called EJB-Add.jar.dodeploy
23:07:15,045 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0027: Starting deployment of "EJB-Add.jar" (runtime-name: "EJB-Add.jar")
23:07:15,063 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) WFLYWELD0003: Processing weld deployment EJB-Add.jar
23:07:15,069 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-6) WFLYEJB0473: JNDI bindings for session bean named 'AddBean' in deployment unit 'deployment "EJB-Add.jar"' are as follows:

      java:global/EJB-Add/AddBean!ejbs.AddBeanRemote
      java:app/EJB-Add/AddBean!ejbs.AddBeanRemote
      java:module/AddBean!ejbs.AddBeanRemote
      java:jboss/exported/EJB-Add/AddBean!ejbs.AddBeanRemote
      java:global/EJB-Add/AddBean
      java:app/EJB-Add/AddBean
      java:module/AddBean

23:07:15,242 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "EJB-Add.jar" (runtime-name : "EJB-Add.jar")


please advise
stttrr.png
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Author Comment

by:gudii9
ID: 42001894
please advise
0
 
LVL 7

Accepted Solution

by:
gudii9 earned 0 total points
ID: 42056511
i found good relevant examples here
http://tomee.apache.org/ejb-3-examples.html
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question