Hi, all


I Considered the following simple class:
[Simple.java]
public class Simple {
public Simple() { }
public static String sayHello(){
return "Hello world";
}
public String sayNonStaticHello(){
return "Hello world";
}
public static void main(String[] args) {
System.out.println(Simple.sayHello());
}
}
Before generating the proxy, i made a "dummy" SimpleHome class.
[SimpleHome.java]
public interface SimpleHome { }
Compile both files. Now, we will build a Powerbuilder application and
use our "Simple" class from Powerscript.
1. Started Powerbuilder.
2. Created a new application, call it "pbjsimple", put everything in
the same directory(.class and .pbl).
3. Start the EJB Proxies Wizard, Type "Simple" as the component and
the classpath is the folder containing the "Simple.class" file.
4. Run the project, Powerbuilder will generate proxies for your
classes and also for most standard Java classes!
5. Next, opened a window from the application and drop a Button and
insert the following Powerscript in the "click event".
6. JavaVM lJavaVM
7. EJBConnection lEJBConn
8. Simple lnv_simple
9. long ll_return
10.
11. lJavaVM = CREATE JavaVM
12.
13. // need to specify the classpath form the Simple class
14. ll_return = &
15. lJavaVM.CreateJavaVM("C:\Applications\rega\dev\Work
\pb9\Target3", FALSE)
16. CHOOSE CASE ll_return
17. CASE 1
18. CASE 0
19. CASE -1
20. MessageBox ( "", "jvm.dll was not found in the classpath.")
21. CASE -2
22. MessageBox ( "", "pbejbclient90.jar file was not found." )
23. CASE ELSE
24. MessageBox ( "", "Unknown result (" + String (ll_return ) +
")" )
25. END CHOOSE
26.
27. IF ll_return < 0 THEN
28. DESTROY lJavaVM
29. END IF
30.
31. lEJBConn = CREATE EJBConnection
32. ll_return = lEJBConn.CreateJavaInstance( lnv_simple, "Simple")
33. IF ll_return <> 0 THEN
34. MessageBox("", "CreateJavaInstance returned "
+string(ll_return))
35. destroy lEJBConn
36. ELSE
37. TRY
38. MessageBox("From Java!" , lnv_simple.sayNonStaticHello())
39. CATCH (CreateException ce)
40. MessageBox( "Create Exception", ce.getMessage() )
41. CATCH (Throwable t)
42. MessageBox(" Other Exception", t.getMessage())
43. END TRY
44. END IF

Everything works fine, in PB I created the EJB proxy, a JavaVM, an
EJBConnection, but when I use to create CreateJavaInstance, it return
-2 error code (Invalid proxy name.
) Please give me solution to this problem