Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » External JS libraries and JBoss deployment
External JS libraries and JBoss deployment [message #59061] Fri, 09 November 2007 16:59 Go to next message
Eclipse UserFriend
Originally posted by: cedric.gaillot.thalesraytheon-fr.com

Hi,

I have begun to deploy my application on JBoss.

All seems to work fine until i insert my custom widget which use the
external js libraries (openlayers) to display a cartographic map. (It
works fine when run from eclipse environment)

I have defined a resource in my project to insert it : (The external
libraries is located at the root of my project)

//---------------------------------------------------------- -----------------
//---------------------------------------------------------- -----------------

package com.trs.rap.widgets.map.openlayers;

import org.eclipse.rwt.resources.IResource;
import org.eclipse.rwt.resources.IResourceManager.RegisterOptions;

import com.trs.rap.tools.HTMLConst;

public class OpenLayersAPIResource implements IResource {

/**
* {@inheritDoc}
*/
public String getCharset() {
return HTMLConst.CHARSET_NAME_ISO_8859_1;
}

/**
* {@inheritDoc}
*/
public ClassLoader getLoader() {
return this.getClass().getClassLoader();
}

/**
* {@inheritDoc}
*/
public RegisterOptions getOptions() {
return RegisterOptions.VERSION;
}

/**
* {@inheritDoc}
*/
public String getLocation() {
return "/OpenLayers.js";
}

/**
* {@inheritDoc}
*/
public boolean isJSLibrary() {
return true;
}

/**
* {@inheritDoc}
*/
public boolean isExternal() {
return true;
}
}

//---------------------------------------------------------- -----------------
//---------------------------------------------------------- -----------------

Then I have configured the plugin.xml file as below :

//---------------------------------------------------------- -----------------
//---------------------------------------------------------- -----------------

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>

<extension
id="com.trs.rap.ihm.themes"
point="org.eclipse.rap.ui.themes">
<theme
id="com.trs.rap.ihm.alttheme"
name="Alternative Demo Theme"
file="theme1/theme.properties"/>
</extension>
<extension
id="com.trs.rap.ihm.entrypoint"
point="org.eclipse.rap.ui.entrypoint">
<entrypoint
class="com.trs.rap.ihm.TestRAPWorkbench"
id="com.trs.rap.ihm.entrypoint1"
parameter="default">
</entrypoint>
</extension>
<extension
id="com.trs.rap.widgets.map.openlayers.OpenLayersMap"
point="org.eclipse.rap.ui.resources">
<resource
class="com.trs.rap.widgets.map.openlayers.OpenLayersAPIResource "/>
<resource
class="com.trs.rap.widgets.map.openlayers.OpenLayersResource "/>
<resource
class="com.trs.rap.widgets.map.openlayers.GeoToolsAPIResource "/>
</extension>

<extension
point="org.eclipse.ui.perspectives">
<perspective
name="Perspective"
class="com.trs.rap.ihm.Perspective"
id="com.trs.rap.ihm.Perspective">
</perspective>
</extension>
<extension
point="org.eclipse.ui.views">
<view
category="one"
name="Map"
class="com.trs.rap.widgets.map.CartographyViewpart"
id="com.trs.rap.widgets.map.CartographyViewpart">
</view>
<view
category="one"
name="Filters"
class="com.trs.rap.widgets.map.CartographicFiltersViewpart"
id="com.trs.rap.widgets.map.CartographicFiltersViewpart">
</view>
<view
category="one"
name="Airbase"
class="com.trs.rap.ihm.resource.AirbaseViewpart"
id="com.trs.rap.ihm.resource.AirbaseViewpart">
</view>
<view
category="one"
name="Center"
class="com.trs.rap.ihm.c2.center.CenterViewpart"
id="com.trs.rap.ihm.c2.center.CenterViewpart">
</view>
<view
category="one"
name="ACO"
class="com.trs.rap.ihm.ACO.ACMViewpart"
id="com.trs.rap.ihm.ACO.ACMViewpart">
</view>
<view
category="one"
name="Track"
class="com.trs.rap.ihm.track.TrackViewPart"
id="com.trs.rap.ihm.track.TrackViewPart">
</view>
<category
id="one"
name="Category 1"/>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="com.trs.rap.ihm.perspectiveExtension1">
</perspectiveExtension>
</extension>
<extension
point="org.eclipse.rap.ui.branding">
<branding
body="body.html"
defaultEntrypointId="com.trs.rap.ihm.entrypoint1"
id="com.trs.rap.ihm.branding1"
servletName="trs"
title="TRS prototype">
</branding>
</extension>
<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/lib"
base-name="/lib">
</resource>
</extension>
<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/img"
base-name="/img">
</resource>
</extension>
<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/"
base-name="/">
</resource>
</extension>
</plugin>

//---------------------------------------------------------- -----------------
//---------------------------------------------------------- -----------------

Then the build.properties file :

source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
art/,\
icons/,\
img/,\
.,\
lib/,\
GeoTools.js,\
theme/,\
theme1/,\
body.html,\
OpenLayers.js

//---------------------------------------------------------- -----------------
//---------------------------------------------------------- -----------------

Then, I have followed the instructions in the deployment tutorial for RAP
application. The jar of my plugin seem to be correct and contains the
external js library.

After deploying the application on Jboss and typed the correct URL on a
browser, I got this javascript error :

/****************************************/

Could not evaluate javascript response:

ReferenceError: OpenLayers is not defined -----> OpenLayers which is a
javascript class

/****************************************/

It seems to be a path problem but I did'nt managed to find how to fix it.

Thanks for your help.

Cédric G.
Re: External JS libraries and JBoss deployment [message #59184 is a reply to message #59061] Sat, 10 November 2007 10:09 Go to previous messageGo to next message
Martin Dilger is currently offline Martin DilgerFriend
Messages: 54
Registered: July 2009
Member
Hi Cédric,

I dont know if that helps, but I had a similar problem which occured
because the library was included AFTER the first call to the class.
So the order in which the resources are included is important.
Perhaps this is an issue to check.

Greetings

Martin
Re: External JS libraries and JBoss deployment [message #59610 is a reply to message #59061] Wed, 14 November 2007 09:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cedric.gaillot.thalesraytheon-fr.com

Hi,

I have tried what you have said to organize the recources of the
plugin.xml in different order but it seems to have no effect on the
execution of the application on a jboss environnement.

I try to change the following lines of the plugin.xml too :

<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/lib"
base-name="/lib">
</resource>
</extension>
<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/img"
base-name="/img">
</resource>
</extension>
<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/"
base-name="/">
</resource>
</extension>

to this :

<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/testRAP/lib"
base-name="/lib">
</resource>
</extension>
<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/testRAP/img"
base-name="/img">
</resource>
</extension>
<extension
point="org.eclipse.equinox.http.registry.resources">
<resource
alias="/testRAP/"
base-name="/">
</resource>
</extension>

But it doesn't work too.
Re: External JS libraries and JBoss deployment [message #59707 is a reply to message #59061] Wed, 14 November 2007 10:28 Go to previous message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

if I understand the snippets you've added correctly you're packaging the
OpenLayer js library into your bundle. That means that the server that runs
the RAP application also provides the js library. That's not what we mean if
we are talking about an external library. Maybe the documentation isn't as
clear as it should be in this case. External doesn't mean third party it
means the library isn't delivered by the same server than the RAP
application.

See the GMap example
( http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. rap.help/help/html/advanced/custom-widget.html):
the maps library is delievered by the URL http://maps.google.com/maps?... So
the external attribute should be false and the libraries should be available
on the bundles classpath, see also the GMap example (GMap.js).


Ciao
Frank

""C
Previous Topic:Eclipse Help System - org.eclipse.help.webapp (conflict with RAP or equinox)
Next Topic:Strange behaviour under linux
Goto Forum:
  


Current Time: Wed Jul 17 15:39:26 GMT 2024

Powered by FUDForum. Page generated in 0.04000 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top