Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » When I package my own Rap to Tomcat, It doesn't work.Why?(When I package my own Rap to Tomcat, It doesn't work.Why?)
icon5.gif  When I package my own Rap to Tomcat, It doesn't work.Why? [message #539262] Thu, 10 June 2010 08:26 Go to next message
zezhenyan  is currently offline zezhenyan Friend
Messages: 16
Registered: March 2010
Junior Member
hi,
I want to change the my own rap project web container for Tomcat.
I have learned the example:
RAP Developer Guide->Advanced Topics->WAR Deployment
I followed this example, but I can show my Rap project.

The differences of my Rap project:
eclipse.rap.demo : only one plug-in project
my own rap: 9 plug-in projects


I can only show home page in the Tomcat. no other plug-in projects

What's the reason?

Thanks

Tyki

[Updated on: Thu, 10 June 2010 08:27]

Report message to a moderator

Re: When I package my own Rap to Tomcat, It doesn't work.Why? [message #539513 is a reply to message #539262] Fri, 11 June 2010 07:30 Go to previous messageGo to next message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

Just checking, you upload it with the Tomcat manager. Its avaialble to you as the folwogin url:

http://yourserver:8080/warfilename/rap?startup=your entry point.

Did you try that? Becouse as far as I know you need to chagne some settings in Tomcat to change the Home screen to a new target.


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
Re: When I package my own Rap to Tomcat, It doesn't work.Why? [message #539522 is a reply to message #539513] Fri, 11 June 2010 07:57 Go to previous messageGo to next message
zezhenyan  is currently offline zezhenyan Friend
Messages: 16
Registered: March 2010
Junior Member
hi,
Martijn Cremer
Thx!

but I have already used the right url as you said. I can deploy the demo of RAP Developer Guide->Advanced Topics->WAR Deployment. But I can't deploy my own rap project.

I find that I remote debug the code, some init code doesn't run, but when I run in rap' s jetty, it do run.
I am very confused. What's wrong with that?
Re: When I package my own Rap to Tomcat, It doesn't work.Why? [message #539543 is a reply to message #539522] Fri, 11 June 2010 08:47 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi,

does this FAQ help you?

http://wiki.eclipse.org/RAP/FAQ#Exported_WAR_file_does_not_w ork


Ralf


zezhenyan wrote:
> hi,
> Martijn Cremer
> Thx!
>
> but I have already used the right url as you said. I can deploy the demo
> of RAP Developer Guide->Advanced Topics->WAR Deployment. But I can't
> deploy my own rap project.
>
> I find that I remote debug the code, some init code doesn't run, but
> when I run in rap' s jetty, it do run.
> I am very confused. What's wrong with that?
Re: When I package my own Rap to Tomcat, It doesn't work.Why? [message #539718 is a reply to message #539543] Sat, 12 June 2010 06:41 Go to previous messageGo to next message
zezhenyan  is currently offline zezhenyan Friend
Messages: 16
Registered: March 2010
Junior Member
hi,
Ralf Sternberg
Thx!

I have red the article of your said. but I can not find the reason.

I think something wrong for my eclipse extension"org.eclipse.rap.ui.layouts ", because some class of this extension doesn't run, when I remote run the rap project.


What's the reason about it?

Tyki

[Updated on: Sat, 12 June 2010 06:42]

Report message to a moderator

Re: When I package my own Rap to Tomcat, It doesn't work.Why? [message #539729 is a reply to message #539718] Sat, 12 June 2010 09:33 Go to previous messageGo to next message
zezhenyan  is currently offline zezhenyan Friend
Messages: 16
Registered: March 2010
Junior Member
"org.eclipse.rap.ui.themes"

I think this extension doesn't work.
Re: When I package my own Rap to Tomcat, It doesn't work.Why? [message #539781 is a reply to message #539729] Sun, 13 June 2010 03:19 Go to previous messageGo to next message
tingel christian is currently offline tingel christianFriend
Messages: 46
Registered: December 2009
Member
Hi zezhenyan:

I wonder whether or not you have tried the following steps:

1, Open $APP_ROOT$/WEB_INF/web.xml
2, Find the "commandline" parameter name and change the value from "-console" to "-console 12345", and then save it;
3, start up Tomcat;
4, start a new cmd console;
5, Execute the following command in the new console:
telnet localhost 12345
6, input ss and enter;
7, Find your application ID and execute diag $APP_ID$
8, The console will tell you what's wrong with your application.

Have a nice Dragon Boat Festival.

Yours Tingel Christian

zezhenyan wrote on Sat, 12 June 2010 17:33
"org.eclipse.rap.ui.themes"

I think this extension doesn't work.

Re: When I package my own Rap to Tomcat, It doesn't work.Why? [message #539786 is a reply to message #539781] Sun, 13 June 2010 05:57 Go to previous messageGo to next message
zezhenyan  is currently offline zezhenyan Friend
Messages: 16
Registered: March 2010
Junior Member
hi,
Tingel Christian

I follow your steps, then this is my result.



osgi> diag com.ibm.research.bluecity.ui.rap
initial@reference:file:plugins/com.ibm.rese
18.jar/ [8]
No unresolved constraints.

Could you help me to analyse it?

Tyki


Re: When I package my own Rap to Tomcat, It doesn't work.Why? [message #539787 is a reply to message #539786] Sun, 13 June 2010 06:09 Go to previous messageGo to next message
tingel christian is currently offline tingel christianFriend
Messages: 46
Registered: December 2009
Member
Hi,

What's the status of your application in the list of ss?Have you tried to start it up if the status is not "STARTED"?

use this command:
start $APP_ID.

A stack trace which presents the reason of the exception will be printed after a failure.

Regards

Tingel Christian

zezhenyan wrote on Sun, 13 June 2010 13:57
hi,
Tingel Christian

I follow your steps, then this is my result.



osgi> diag com.ibm.research.bluecity.ui.rap
initial@reference:file:plugins/com.ibm.rese
18.jar/ [8]
No unresolved constraints.

Could you help me to analyse it?

Tyki




Re: When I package my own Rap to Tomcat, It doesn't work.Why? [message #539881 is a reply to message #539787] Mon, 14 June 2010 07:58 Go to previous message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

A quick runtrough to a guide i writen (lacking images) I hope this helps. This works on the latest RAP RC3.

Getting RAP on your tomcat
I want to introduce you to RAP because I think RAP is the future. After I came back from an Eclipse RCP training, my boss asked me if we could make proof of concept of single sourcing with RAP. Well, you can imagine what I thought about single sourcing after just having learnt the Eclipse RCP way. But after only a week of reading up on RAP and trying it out I saw the benefit of RAP straight away. With just one set of projects and a few fragments depending on the Target, we had a nice single-sourced project that looked professional and was easy to maintain.

The only problem I had with RAP was the deployment of getting it running outside your own Eclipse environment and running it on a Tomcat server. It was a complex road and all the documentation I found was far outdated. This made my work only harder. I am not the only one having problems and as stated in the GOOGLE Summer Code Project proposal, the RAP forum is filled with questions about it. So the need from the user community is a good user-friendly, not overly complex system to deploy your RAP project. Now, its great news that we are going to have the "RAP/Equinox WAR products", but they will start only after the 24th of May and this means that for now we are sort of stuck with the old ways.

Now the main problem is that most info about war deployment you can find is a tad outdated. Open Source projects have the tendency to improve rapidly over time and thus a lot has to be kept up to date. This is a hassle sometimes. So its up to us, the users, to do that. So here is the updated version for you RAP users out there to deploy your own RAP project as a WAR file. Its done in two steps: step 1 we will just make the servlet bridge work (that's most of the work) and in step 2 we will try to make a RAP application work. I hope this will help all the RAP enthusiasts out there.

1. Just try getting the equinox bridge to work.
Firs step when having problems with getting your RAP working is getting the Equinox system working in your WAR container. Try downloading this Team project file.

<?xml version="1.0" encoding="UTF-8"?>
<psf version="2.0">
<provider id="org.eclipse.team.cvs.core.cvsnature">
<project reference="1.0,:pserver:dev.eclipse.org:/cvsroot/tools,org.eclipse.orbit/javax.servlet,javax.servlet,v2_5"/>
<project reference="1.0,:pserver:dev.eclipse.org:/cvsroot/rt,org.eclipse.equinox/server-side/bundles/org.eclipse.equinox.http.registry,org.eclipse.equinox.http.registry"/>
<project reference="1.0,:pserver:dev.eclipse.org:/cvsroot/rt,org.eclipse.equinox/compendium/bundles/org.eclipse.equinox.http.servlet,org.eclipse.equinox.http.servlet"/>
<project reference="1.0,:pserver:dev.eclipse.org:/cvsroot/rt,org.eclipse.equinox/server-side/bundles/org.eclipse.equinox.http.servletbridge,org.eclipse.equinox.http.servletbridge"/>
<project reference="1.0,:pserver:dev.eclipse.org:/cvsroot/rt,org.eclipse.equinox/server-side/bundles/org.eclipse.equinox.servletbridge,org.eclipse.equinox.servletbridge"/>
<project reference="1.0,:pserver:dev.eclipse.org:/cvsroot/eclipse,equinox-incubator/org.eclipse.equinox.servletbridge.feature,org.eclipse.equinox.servletbridge.feature"/>
<project reference="1.0,:pserver:dev.eclipse.org:/cvsroot/eclipse,org.eclipse.update.configurator,org.eclipse.update.configurator"/>
</provider>
</psf>

Note: if there is a question about user name pass use the username anonymous

Now normally this would be enough. But the guys from the RAP team created a great automated method for creating a WAR archive. So we are going to import it as well. You can use the following TEAM project:

<?xml version="1.0" encoding="UTF-8"?>
<psf version="2.0">
<provider id="org.eclipse.team.cvs.core.cvsnature">
<project reference="1.0,:pserver:dev.eclipse.org:/cvsroot/rt,org.eclipse.rap/releng/org.eclipse.rap.demo.feature,org.eclipse.rap.demo.feature"/>
</provider>
</psf>


Copy the org.eclipse.rap.demo feature as org.eclipse.equinox.servlet.new.feature.
Copy the feature.xml from the old org.eclipse.equinox.servlet.feature so that you have the basics.
When you done that, unfold the templates folder - we need to edit it a bit. First off, open the web.xml we need to remove the <!-- --> comment out of the following text:

		<init-param>
			<param-name>commandline</param-name>
			<param-value>-console</param-value>			
		</init-param>


This will enable the OSGi console if you successfully deploy the WAR file to a server in its console. You can add a port number after the console if you want to telnet to it. Next, you change the false to true for the following part:

		<init-param>
			<param-name>enableFrameworkControls</param-name>
			<param-value>true</param-value>			
		</init-param>


This will enable the controls of the framework trough the web interface. Read more about it here.

Remove the following parts:

<!-- Enable multi-language support for the extension registry -->
<init-param>
<param-name>commandline</param-name>
<param-value>-registryMultiLanguage</param-value>
</init-param>

<!-- Framework Controls could be useful for testing purpose, but
we disable it in RAP environment per default -->

Now we go to the eclipse folder, edit launch.ini and change it as follows:

osgi.parentClassloader=app
osgi.contextClassLoaderParent=app
Note: you can read more about this in the Eclipse FAQ No. 105

What you need to do now is to edit the ant script in the script folder. Find the property webapp.name and features and change them to the following:

    <property name="webapp.name" value="bridge" />
    <property name="features" value="org.eclipse.equinox.servletbridge.new.feature" />


Now you can run the Ant script by going to Run>External Tools>External Tools configuration. Here you create a new launch configuration for the Ant builder. Go to the JRE tab and change the Runtime JRE to "Run the same JRE as Workspace". This will enable the antscript to use the PDE.Builder to build the bundles. Click on Run. The JRE will start and you will see PDE.Export running. Remember to refresh the feature project. You will see a BUILD folder been added. Now, unfold the scr folder till you have the ConfigIniCreator.java file. Open it and change the file location to:

{Projectfolder}\\org.eclipse.equinox.servletbridge.new.featu re\\build\\bridge\\WEB-INF\\eclipse\\plugins

Save the changes and run it - you will get the following output:
#Eclipse Runtime Configuration File
osgi.bundles= org.eclipse.equinox.common@2:start,\
org.eclipse.equinox.http.registry@start,\
org.eclipse.equinox.http.servletbridge@start,\
org.eclipse.equinox.http.servlet@start,\
org.eclipse.equinox.registry@start,\

osgi.bundles.defaultStartLevel=4

Copy this and go to build>bridge>WEB-INF>eclipse>configuration folder. Edit the config.ini file and paste in the generated output, Save it.
Now we got everything you need in a war file, it is just not there yet. Use any archive application you want and use the zip compression. Rename the zipped file to bridge.war and voila, you got yourself a Web Application Archive that is ready to be deployed to your servlet server.

2. Getting your RAP project on the tomcat.
First copy the org.eclipse.equinox.servlet.new.feature and name it to your liking.

First, a small reminder: if you are (as I was) single sourcing and set every RCP and RAP part to optional, the instructions in this manual will not work for you. Before making your product, check all your plugins and set the optional flag off for your RAP dependencies so that you can actually validate dependencies.

In the feature we add org.eclipse.rap.ui. Now we create a new product file trough file>new>product configuration. Set the product configuration to feature.

Go to the dependencies page and add the feature you created. Press the validate button.

You can see that there are some dependencies missing, for example javax.servlet, and javax.servlet.http. You only want to see those two (javax.servlet, and javax.servlet.http) missing. So add any missing constraint until you have the whole basic framework of RAP implemented. Add you application plugin and keep repeating the validation process till all the plugins you see are only missing the javax.servlet, and javax.servlet.http constraint. There is one exception to this rule - the org.eclipse.equinox.http.servletbridge wants org.eclipse.equinox.servletbridge, but you can ignore this as well.

When you are done, you can run the ant script again and zip the created WEB-INF to a zip/war file. Before you deploy this, undeploy the bridge.war if you have not done it already. And then deploy the war. If you want to put this on a production server, you will have to change the following in the web.xml of your deployable war so it will use less resources and give faster response:

	<!--
	<init-param>
		<param-name>commandline</param-name>
		<param-value>-console</param-value>			
	</init-param>
	-->

		<init-param>
			<param-name>enableFrameworkControls</param-name>
			<param-value>false</param-value>			
		</init-param>


There you have it. Until the summer code project is done and forms part of the RAP release, this will be the way to create your WAR files.


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
Previous Topic:Why is CommandContributionItem a final class in RAP?
Next Topic:RAP Eclipse Help System
Goto Forum:
  


Current Time: Tue Dec 07 13:22:01 GMT 2021

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

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

Back to the top