• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OSGI: problem in registerResources , 404 error

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all

I am studying OSGI recently.

I have some problem in the sample code.

My source file as below:
src
- org/riawork/demo/user/validator
- org/riawork/demo/web/servlet/LoginServlet
- page/login.htm

I register the page in the the Activator.


But when I input the url "http://localhost/demo/page/login.htm" in IE.
The HTTP 404 occur.
Are there any wrong in my sample code?
My Activator soucre code as below


Best Regards
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is "demo" the name of the web app of which this code is a part? If so, I'd guess that any URLs need to be of the form "/login" instead "/demo/login".
 
avseq anthoy
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.
I didn't create Web Project in eclipse. I only create a normal java project.
And the register the path use the OSGI HttpService.

Lester Burnham wrote:Is "demo" the name of the web app of which this code is a part? If so, I'd guess that any URLs need to be of the form "/login" instead "/demo/login".

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you certain that the HttpService runs on port 80 of localhost at the root level?

Have you gotten an unaltered example of HttpService to run?
 
avseq anthoy
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes , I am sure that HttpService runs on port 80.
If I stop the osgi , the IE shows "can't find server".
But if I start the osgi , the IE shows

HTTP ERROR 404
Problem accessing /demo/page/login.htm. Reason:

ProxyServlet: /demo/page/login.htm


Lester Burnham wrote:Are you certain that the HttpService runs on port 80 of localhost at the root level?

Have you gotten an unaltered example of HttpService to run?

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A quick search for registerResources examples indicates that the 2nd parameter is an absolute directory path. Which would make the relative path you're using problematic (as relative paths always are in web apps). Which brings us back to:

Lester Burnham wrote:Have you gotten an unaltered example of HttpService that uses registerResources to run?

 
avseq anthoy
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My source code is similar to the original sample code except the import statemensts.
And the file location structure are same.
Because the sample code has some chinese word thant only print some text, so I delete it.
It should not influence overall work.
Original sample code as below.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And did you get that code to run OK?
 
reply
    Bookmark Topic Watch Topic
  • New Topic