• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

EJB simple client is not running

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have just started EJB.
I am trying to run sample examples.
While running I am getting NullPointerException.
Do I missing anything?


I am using Eclipse JEE .


following are code files:
package ejb3inaction.example;
import javax.ejb.Stateless;
@Stateless
public class HelloUserBean implements HelloUser {
public void sayHello(String name) {
System.out.println("Hello " + name + " welcome to EJB 3 In Action!");
}
}


package ejb3inaction.example;
import javax.ejb.Remote;
@Remote
public interface HelloUser {
public void sayHello(String name);
}



package ejb3inaction.example;

import javax.ejb.EJB;

import ejb3inaction.example.HelloUser;

public class HelloUserClient {
@EJB
private static HelloUser helloUser;

public static void main(String[] args) {


helloUser.sayHello("Curious George");
System.out.println("Invoked EJB successfully .. see server console for output");
}
}


Thanks in advance !

-- Pratik.

 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To inject a EJB in a standalone client, you will need a Application Client Container. See this thread for details.
 
Pratik Patil
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks !
What are the steps to create and deploy EJB application?

-- Pratik.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which application server do you use? Usually, you will find tutorials for deploying the EJBs in the application server documentation. The JavaEE guide is also a good starting point
 
Pratik Patil
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JBoss 5.0 and Eclipse Galilo.
I have created new EJB project and source file which I have posted(Pl refer my first post).
When I do --> run on server --> I am getting error for persistance .xml .
Now, Pl tell me how to configure persistance.xml for MySql database.
And pl re correct my deployment steps if I am missing anything.

-- Pratik.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Pratik Patil wrote:I am using JBoss 5.0 and Eclipse Galilo.
I have created new EJB project and source file which I have posted(Pl refer my first post).
When I do --> run on server --> I am getting error for persistance .xml .



I personally never use IDEs to run the applications. So i won't be able to help there. If you are looking for tutorials on building, deploying and running EJB3 examples on JBoss, then follow the docs here
 
Ranch Hand
Posts: 246
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pratik,

This will help you a lot "Mikalai Zaikin's SCBCD 5.0 Guide, also available in Word and PDF format". The appendix of this guide will show you everything you need for your application.

Thanks,

Naveen
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic