Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

RAP/FAQ

< RAP
Revision as of 12:13, 12 December 2007 by Unnamed Poltroon (Talk) (specify is not for EJB3 calls)

| RAP wiki home | RAP project home |

This section is intended to host differents Faqs about RAP and RWT. One source could be the newsgroup about RAP itself...


How to hide the window in rap

[| Lien]

Exported .war does not work

My application is working at development time, but when I export it the web application does not work. Check the following:

  • check your build.properties
    • are you exporting the plugin.xml
    • are all libraries you are using in the plugin.jars
    • TIP: As pde build sometimes swallows error messages try exporting your feature with "Deployable feature" export, this may turn up error messages
  • enable the osgi console by adding this init-param to the web.xml:
  <init-param>
     <param-name>commandline</param-name>
     <param-value>-console</param-value>			
  </init-param>
    • you may want to add a port after -console in unix environments, you can then telnet to the osgi console
    • type ss in the console and see if all bundles are started. If not try starting them with "start <bundle-id>"
    • the stack traces may hint to what is missing
  • start with a working example: rapdemo.war and integrate your plugins

How do I add an applet / flash / an existing Javascript libary

  • A very simplistic approach is to create a html page (or a servlet) containing your applet / flash / JS. You can simply use the browser widget to load that page within your application.
  • A tighter integration can be achieved by developing a custom widget as explained here (integrating GMap): custom widget tutorial

How do I make remote calls to EJB's deployed on Jboss 4.x AS

This is not a solution for calling local interface EJB's (I wasn't able to do it :( ), neither for EJB3 specification (didn't tried yet)

Nevertheless is more useful to make remote calls as the RAP application and the JBoss AS could be on separate machines (or will be sometime in the application life-cycle)

  • prepare a jar with EJB's interfaces which you are about to call from RAP (I think here you may use it wrapped as a bundle if you want to separate it from your application bundle)
  • put the jar in the application runtime classpath or add it as a dependency plugin if you use it as a bundle
  • add the following jar's from the jboss installation folder in the application runtime classpath : jboss.jar, jboss-remoting.jar, jboss-serialization.jar, jbosssx.jar, jboss-transaction.jar, jnpserver.jar

Here's an example code for calling the EJB's remote interface :

Hashtable<String, String> props = new Hashtable<String, String>();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
props.put(Context.PROVIDER_URL, "jnp://localhost:1099"); //here you put your JBoss AS server's address
Context ctx = null;
try {
	ctx = new InitialContext(props);
} catch (NamingException e) {
	throw new RuntimeException("fail to get initial context", e);
}
Object obj = null;
try {
	obj = ctx.lookup("Test"); //The jndi ejbs name is Test
} catch (NamingException e) {
	throw new RuntimeException("could not obtain test home interface", e);
}
TestHome home = (TestHome) PortableRemoteObject.narrow(obj, TestHome.class);
try {
	testService = home.create();
} catch (CreateException e) {
	throw new RuntimeException("could not create test remote interface", e);			
} catch (RemoteException e) {
	throw new RuntimeException("remote exception when creating test remote interface", e);
}
try {
	testService.callSomeBusinessMethod(...);
} catch (RemoteException e) {
	throw new RuntimeException("remote exception when calling business method", e);
}

Back to the top