Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,544 members, 7,808,997 topics. Date: Thursday, 25 April 2024 at 08:50 PM

I Am Stuck With This Problem (JAVA EE) - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / I Am Stuck With This Problem (JAVA EE) (1176 Views)

Java EE Developer And Spring Developer In Here. / Learn Java EE With Me / Help! Im Stuck With This C# Program (2) (3) (4)

(1) (Reply) (Go Down)

I Am Stuck With This Problem (JAVA EE) by ugwum007(m): 12:09am On Sep 15, 2016
I decided to spread my wings with java and ventured into Java EE, am using an online ebook and am stuck with this error for like 3 days now. Pls can someone help?
here is the error:

EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:EJBtut, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@100fc185
java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:EJBtut, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@100fc185
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:798)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:255)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:200)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146)
at com.sun.proxy.$Proxy2.addBook(Unknown Source)
at client.EjbTester.tasteStatelessEJB(EjbTester.java:80)
at client.EjbTester.main(EjbTester.java:46)


This is my remote client class:

public class EjbTester {
BufferedReader brConsoleReader = null;
Properties props;
InitialContext ctx;
Context remoteContext;

public static void main(String[] args) {

EjbTester ejbtester = new EjbTester();
ejbtester.tasteStatelessEJB();
}

private void tasteStatelessEJB(){
try{
props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"wink;
props.put(Context.PROVIDER_URL, "http-remoting://localhost:8050"wink;
props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"wink;
props.put(Context.SECURITY_PRINCIPAL, "steinacoz"wink;
props.put(Context.SECURITY_CREDENTIALS, "nkenna007"wink;
props.put("jboss.naming.client.ejb.context", true);

ctx = new InitialContext(props);

}catch(NamingException ex){
ex.printStackTrace();
}

brConsoleReader = new BufferedReader(new InputStreamReader(System.in));

try{
int choice = 1;
LibrarySessionBeanRemote libraryBean = (LibrarySessionBeanRemote) ctx.lookup("ejb:/EJBtut/LibrarySessionBean!tut.LibrarySessionBeanRemote"wink;
while(choice != 2){
String bookName;

String strChoice = brConsoleReader.readLine();
choice = Integer.parseInt(strChoice);
if(choice == 1){
System.out.println("Enter Book Name: "wink;
bookName = brConsoleReader.readLine();
libraryBean.addBook(bookName);
}else if(choice == 2){
break;
}
}

List<String> booksList = libraryBean.getBooks();
System.out.println("Books entered so far: " + booksList.size());

for(int i = 0; i < booksList.size(); i++){
System.out.print((i+1) + "." + booksList.get(i));
}
ctx.close();

LibrarySessionBeanRemote libraryBean1 = (LibrarySessionBeanRemote) ctx.lookup("ejb:/EJBtut/LibrarySessionBean!tut.LibrarySessionBeanRemote"wink;
List<String> booksList1 = libraryBean.getBooks();
System.out.print("---using lookups to get library stateless objects--"wink;
System.out.print("Books Entered so far: " + booksList1.size());

for(int i = 0; i < booksList1.size(); i++){
System.out.print((i+1) + "." + booksList1.get(i));
}

}catch(Exception e){
System.out.println(e.getMessage());
e.printStackTrace();
}finally{
try{
if(brConsoleReader != null){
brConsoleReader.close();
}
}catch(IOException ex){
System.out.println(ex.getMessage());
ex.printStackTrace();
}
}
}


}


the remote interface:

@Remote
public interface LibrarySessionBeanRemote {
void addBook (String book);

List getBooks();

}


the SessionBean

@Stateless
public class LibrarySessionBean implements LibrarySessionBeanRemote{
List<String> bookShelf;

public LibrarySessionBean() {
bookShelf = new ArrayList<String>();
}



// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method"wink




public void addBook(String bookName) {
bookShelf.add(bookName);
}


public List<String> getBooks() {
return bookShelf;
}
}


Am using Netbeans 8.1 and wildfly 10 server
Re: I Am Stuck With This Problem (JAVA EE) by KvnqPrezo(m): 9:17pm On Sep 15, 2016
LOL wait for the gurus in the house...DHTML
.
Wait lemme mention 'em
Re: I Am Stuck With This Problem (JAVA EE) by ugwum007(m): 9:44pm On Sep 15, 2016
KvnqPrezo:
LOL wait for the gurus in the house...DHTML
.
Wait lemme mention 'em

thanks although I have resolved it but am faced with another one maybe later in the day i will upload it
Re: I Am Stuck With This Problem (JAVA EE) by ugwum007(m): 9:47pm On Sep 15, 2016
removed 'ejb:/' in these two lines and added jboss client.jar to my project library.

LibrarySessionBeanRemote libraryBean = (LibrarySessionBeanRemote) ctx.lookup("ejb:/EJBtut/LibrarySessionBean!tut.LibrarySessionBeanRemote";
LibrarySessionBeanRemote libraryBean1 = (LibrarySessionBeanRemote) ctx.lookup("ejb:/EJBtut/LibrarySessionBean!tut.LibrarySessionBeanRemote";

(1) (Reply)

Database And Internet Data Retriever / I Need A Programmer To Help Solve MMM Clone P2P Script Bug. / Computer Programming Center

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 18
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.