Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

EJB simple client is not running

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic