You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by parker <pa...@yahoo.com> on 2014/07/08 20:06:45 UTC

deploy a war web project on karaf, don't work.

Hi, 

With Karaf 3 I can deploy wab project and war project.
I have made a no OSGi web project . I want to deploy that on Karaf 3. How to
do it ?

Using netbeans ,  I have made a war file from my web project and I have 
install on Karaf 3 the .war project using that : bundle:install -s
file:/path/myproject.war
I have no error for the install.
But  I can't see that working when I go to http://localhost:8181/myproject . 

Then Why that don't work? What is the problem ?

Thank you for your advice and help, 






--
View this message in context: http://karaf.922171.n3.nabble.com/deploy-a-war-web-project-on-karaf-don-t-work-tp4034063.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: deploy a war web project on karaf, don't work.

Posted by parker <pa...@yahoo.com>.
Hi ,

Thank you for your fast answer, 


Unfortunately I haven't seen your answer before to post a new question about
the user guide.

I don't understand what mean "You can note the webbundle prefix, and the
Bundle-SymbolicName and Web-ContextPath headers on the URL." 

Please to answer to that here : 
http://karaf.922171.n3.nabble.com/Karaf-3-0-0-and-deploying-a-war-using-the-userguide-td4034070.html

Sorry to have duplicate the subject.

Regards, 





--
View this message in context: http://karaf.922171.n3.nabble.com/deploy-a-war-web-project-on-karaf-don-t-work-tp4034063p4034071.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: deploy a war web project on karaf, don't work.

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

If your war is a pure war (not an OSGi one), you have to use webbundle 
url protocol:

karaf@root()> bundle:install -s 
"webbundle:http://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war?Bundle-SymbolicName=tomcat-sample&Web-ContextPath=/sample"

You can find details about WebContainer in the user guide:

http://karaf.apache.org/manual/latest/users-guide/webcontainer.html

Regards
JB

On 07/08/2014 08:06 PM, parker wrote:
> Hi,
>
> With Karaf 3 I can deploy wab project and war project.
> I have made a no OSGi web project . I want to deploy that on Karaf 3. How to
> do it ?
>
> Using netbeans ,  I have made a war file from my web project and I have
> install on Karaf 3 the .war project using that : bundle:install -s
> file:/path/myproject.war
> I have no error for the install.
> But  I can't see that working when I go to http://localhost:8181/myproject .
>
> Then Why that don't work? What is the problem ?
>
> Thank you for your advice and help,
>
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/deploy-a-war-web-project-on-karaf-don-t-work-tp4034063.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: deploy a war web project on karaf, don't work.

Posted by Achim Nierbeck <bc...@googlemail.com>.
Looks a lot like the given web application doesn't contain a welcome-file
entry in its web.xml,
after installing and issueing web:list + http:list

karaf@root()> web
web          web:list     web:start    web:stop
karaf@root()> web:list
ID  | State       | Web-State   | Level | Web-ContextPath | Name
-----------------------------------------------------------------------------
103 | Active      | Deployed    | 80    | /sample         | tomcat-sample
(0)
karaf@root()> http
http         http:list
karaf@root()> http:list
ID  | Servlet           | Servlet-Name | State       | Alias | Url
---------------------------------------------------------------------------------------------------------------------------
103 | JspServletWrapper | jsp          | Deployed    |       | [*.jsp,
*.jspx, *.jspf, *.xsp, *.JSP, *.JSPX, *.JSPF, *.XSP]
103 | ResourceServlet   | default      | Deployed    | /     | [/]
103 |                   | HelloServlet | Deployed    |       | [/hello]
karaf@root()>

I've seen you need to call
http://localhost:8181/sample/hello

which works right away.

If you take a look at the Pax Web project at [1] you're gonna see there are
a lot of samples [2] to use with Karaf / Pax Web available. All of those
samples are also actually used in the integration tests [3], so in case of
worrying on how to use a quick check there will help.

regards, Achim

[1] - https://github.com/ops4j/org.ops4j.pax.web
[2] - https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples
[3] -
https://github.com/ops4j/org.ops4j.pax.web/tree/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty



2014-07-09 0:37 GMT+02:00 parker <pa...@yahoo.com>:

> firstly I clean the data folder of karaf and i do ./karaf -c -clean
> secondly :
> I do that :
> karaf@root()> bundle:install -s
> "webbundle:
> http://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war?Bundle-SymbolicName=tomcat-sample&Web-ContextPath=/sample
> "
> Bundle ID: 114
> karaf@root()>
>
> karaf@root()> web:list
> ID  | State       | Web-State   | Level | Web-ContextPath | Name
>
> -----------------------------------------------------------------------------
> 114 | Active      | Deployed    | 80    | /sample         | tomcat-sample
> (0)
> karaf@root()>
>
>
>
> but in http://localhost:8181/sample/ i have :
> HTTP ERROR 404
> Problem accessing /sample/. Reason:
>     Not Found
> Powered by Jetty://
>
>
> I don't  understand why it's not working.
>
>
> Thank you for your advice.
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/deploy-a-war-web-project-on-karaf-don-t-work-tp4034063p4034075.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Software Architect / Project Manager / Scrum Master

Re: deploy a war web project on karaf, don't work.

Posted by parker <pa...@yahoo.com>.
firstly I clean the data folder of karaf and i do ./karaf -c -clean
secondly :
I do that :
karaf@root()> bundle:install -s
"webbundle:http://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war?Bundle-SymbolicName=tomcat-sample&Web-ContextPath=/sample" 
Bundle ID: 114
karaf@root()> 

karaf@root()> web:list
ID  | State       | Web-State   | Level | Web-ContextPath | Name             
-----------------------------------------------------------------------------
114 | Active      | Deployed    | 80    | /sample         | tomcat-sample
(0)
karaf@root()> 



but in http://localhost:8181/sample/ i have :
HTTP ERROR 404
Problem accessing /sample/. Reason:
    Not Found
Powered by Jetty://


I don't  understand why it's not working.


Thank you for your advice.





--
View this message in context: http://karaf.922171.n3.nabble.com/deploy-a-war-web-project-on-karaf-don-t-work-tp4034063p4034075.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: deploy a war web project on karaf, don't work.

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,

You'll need to use the webbundle URL hander.
This is a prefix to your URL.
webbundle:file:path/myproject.war?WebContext-Path=myproject

Regards, Achim

sent from mobile device
Am 08.07.2014 20:07 schrieb "parker" <pa...@yahoo.com>:

> Hi,
>
> With Karaf 3 I can deploy wab project and war project.
> I have made a no OSGi web project . I want to deploy that on Karaf 3. How
> to
> do it ?
>
> Using netbeans ,  I have made a war file from my web project and I have
> install on Karaf 3 the .war project using that : bundle:install -s
> file:/path/myproject.war
> I have no error for the install.
> But  I can't see that working when I go to http://localhost:8181/myproject
> .
>
> Then Why that don't work? What is the problem ?
>
> Thank you for your advice and help,
>
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/deploy-a-war-web-project-on-karaf-don-t-work-tp4034063.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>