External JS libraries and JBoss deployment [message #59061] |
Fri, 09 November 2007 16:59 |
Eclipse User |
|
|
|
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 #59610 is a reply to message #59061] |
Wed, 14 November 2007 09:40 |
Eclipse User |
|
|
|
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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02955 seconds