• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help needed to deploy HelloWorld EJB

 
Ranch Hand
Posts: 38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I was following the step by step approch given in Beginning EJB3 Application Development book about the EJB3 Hello World deployment. I am deploying the EJB mannually, that is I am nit using any tool. I am new to EJB3. I deployed the bean it was successfull and I am stuck in Client deployment. I deployed the client as given in the book.But I am getting the following error. Could anyone help me why I am getting the error.. I am trying it since 2 days.

com.sun.enterprise.appclient.UserError: Appclient main-class is not found. Plea
se check the main-class entry of your appclient manifest file, the mainclass com
mand-line argument, and your classpath.
java.lang.ClassNotFoundException:


Regards
Vasanthi


 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can anybody please please..... help me. I set theclasspath of ejb jar file in Manifest.mf file of client Then when i use the command appclient to run the client i am getting the following exception


C:\EJBSamples\HelloWorldProject\dist>appclient -client helloworldapp.jar
11-Jun-2009 13:52:28 com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
com.sun.enterprise.InjectionException: Exception attempting to inject Resolved Ejb-Ref helloworld.client.Hell
oWorldClient/helloWorld@jndi: - > HelloWorldBean into class helloworld.client.HelloWorldClient
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
at com.sun.enterprise.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:144)
at com.sun.enterprise.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:136)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:420)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
Caused by: javax.naming.NameNotFoundException: #helloworld.ejb.HelloWorld not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.j
ava:129)
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 com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerReque
stDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatc
herImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorI
mpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.jav
a:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:
1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:
223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.jav
a:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563
)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)

at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Exception in thread "main" java.lang.RuntimeException: com.sun.enterprise.InjectionException: Exception attem
pting to inject Resolved Ejb-Ref helloworld.client.HelloWorldClient/helloWorld@jndi: - > HelloWorldBean into
class helloworld.client.HelloWorldClient
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:487)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Resolved Ejb-Ref helloworld.
client.HelloWorldClient/helloWorld@jndi: - > HelloWorldBean into class helloworld.client.HelloWorldClient
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
at com.sun.enterprise.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:144)
at com.sun.enterprise.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:136)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:420)
... 2 more
Caused by: javax.naming.NameNotFoundException: #helloworld.ejb.HelloWorld not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.j
ava:129)
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 com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerReque
stDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatc
herImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorI
mpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.jav
a:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:
1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:
223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.jav
a:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563
)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)

at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)

C:\EJBSamples\HelloWorldProject\dist>appclient -client helloworldapp.jar
11-Jun-2009 13:56:05 com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
com.sun.enterprise.InjectionException: Exception attempting to inject Resolved Ejb-Ref helloworld.client.Hell
oWorldClient/helloWorld@jndi: - > HelloWorldBean into class helloworld.client.HelloWorldClient
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
at com.sun.enterprise.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:144)
at com.sun.enterprise.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:136)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:420)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
Caused by: javax.naming.NameNotFoundException: #helloworld.ejb.HelloWorld not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.j
ava:129)
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 com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerReque
stDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatc
herImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorI
mpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.jav
a:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:
1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:
223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.jav
a:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563
)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)

at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Exception in thread "main" java.lang.RuntimeException: com.sun.enterprise.InjectionException: Exception attem
pting to inject Resolved Ejb-Ref helloworld.client.HelloWorldClient/helloWorld@jndi: - > HelloWorldBean into
class helloworld.client.HelloWorldClient
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:487)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Resolved Ejb-Ref helloworld.
client.HelloWorldClient/helloWorld@jndi: - > HelloWorldBean into class helloworld.client.HelloWorldClient
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
at com.sun.enterprise.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:144)
at com.sun.enterprise.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:136)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:420)
... 2 more
Caused by: javax.naming.NameNotFoundException: #helloworld.ejb.HelloWorld not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.j
ava:129)
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 com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerReque
stDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatc
herImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorI
mpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.jav
a:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:
1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:
223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.jav
a:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563
)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)

at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)

C:\EJBSamples\HelloWorldProject\dist>



PLSSSSSSSSSSSSSSSSSSSSSSSSS help me.


Many Thanks
Vasanthi
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See one of my examples, I am using JBoss:







And client:


The jndi.properties file:



Hope it helps...
 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Actually in my EJB I am not using the JNDI properties, is it must?? if so then where will I put that file & how to deply it... please tell me...

kind regards
vasanthi
 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello I am waiting for some reply, please help me. My code looks like this

Remote interface

package helloworld.ejb;
import javax.ejb.Remote;
@Remote
public interface HelloWorld {
public String outputHelloWorld();
}

Bean class


package helloworld.ejb;
import javax.ejb.Stateless;
@Stateless
public class HelloWorldBean implements helloworld.ejb.HelloWorld {
public String outputHelloWorld() {
return "Hello World!";
}
}


And my client

package helloworld.client;
import javax.ejb.EJB;
import helloworld.ejb.HelloWorld;
public class HelloWorldClient {
@EJB
private static HelloWorld helloWorld;
public static void main (String[] args)
{
System.out.println(helloWorld.outputHelloWorld());
}
}

Manifest file

Manifest-Version: 1.0
Main-Class: helloworld.client.HelloWorldClient

And the last application.xml


<?xml version="1.0" encoding="UTF-8"?>
<application version="5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_5.xsd">
<display-name>helloworldejb</display-name>
<module>
<ejb>helloworldejb.jar</ejb>
</module>
<module>
<java>helloworldclient.jar</java>
</module>
</application>


I have been working on it more than a week, I am not able to continue my study as I am stuck , I am not using any JNDI properties file I would really appriciate an early response. The server I am using is glassfish & I am not using an IDE.

Regards
Vasanthi
 
Ranch Hand
Posts: 463
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vasanthi,

Since you are trying to access EJB3 from outside (I mean outside of EJB container) you need to use JNDI look up to get a reference of the bean. Refer to the previous reply for the code example. If you access EJB from servlet which deployed in the same container you can use DI. Or else you need to use look up.

Hope this helps.
 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sai,

I took this example from Beginning EJB3 Application Development book, in that the author has not told anything about the JNDI look up. So if I have to call EJB from a stand alone java application should I have to user JNDI look up?? Also i don't know where to store the file during the package and also how to write the JNDI properties, is there any link where I get the step by step approach.

Many Thanks
Vasanthi
 
Sai Surya
Ranch Hand
Posts: 463
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vasanthi hiremath wrote:Hi Sai,

I took this example from Beginning EJB3 Application Development book, in that the author has not told anything about the JNDI look up. So if I have to call EJB from a stand alone java application should I have to user JNDI look up?? Also i don't know where to store the file during the package and also how to write the JNDI properties, is there any link where I get the step by step approach.

Many Thanks
Vasanthi



Hello Vasanthi,

The following link may help you.

http://www.webagesolutions.com/knowledgebase/javakb/jkb005/index.html

and yes, since client is outside the EJB container we need to use JNDI look up and no need for any properties. You can use annotations approach for JNDI lookup. Look at the above link.

 
Vasanthi hiremath
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally I am successfull....

Thanks a tonn Sai Surya...

Kind Regards
vasanthi
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic