Avatar billede fredand Forsker
27. november 2002 - 09:49 Der er 9 kommentarer og
1 løsning

Problems with ear-file with JBoss!!!

Hello Amigos!
(
I have already asked this but I pushed the wrong button "accept", but I do not got it to work. So I have ask it again.
)

I have problems with deploying a ear-file at JBoss. When I try to deploy it at a Orion it works fine but not with JBoss.

The ear-file contains both a JSP and a Servlet. The JSP seams to work with Orion JBoss but not the servlet.

I want to make a ear-file thats works at both Orion and JBoss.

So if any one could tell me whats wrong I would be most happy!

You can download the file at: http://www.it-gymnasiet.info/programmering_c/enterprise_web.ear

It is a very small ear-fil.

Best regards
Fredrik

Ps please answer in english
-----------------------------------
Arne_v wrote
JBoss 2.4.x with Tomcat
JBoss 2.4.x with Jetty
JBoss 3.0.x (with Jetty)
JBoss 3.0.x with Tomcat

?

-----------------------------------
Arne_v wrote
What errors do you get ?
--------------------------
Arne_v wrote
In your JSP you refer to:

servlet/ControllerServlet => entrprise_web/servlet/ControllerServlet

In your web.xml you define:

<url-pattern>/ControllerServlet</url-pattern> =>
enterprise_web/ControllerServlet

This does not work together !
-------------------------------------
I wrote and pushed the worng button

Hello!

I have tried and tried to deploy the ear-fil but I cant get it right at JBoss.
I Only reach teh index.html but not the servlet. In Orion everything works fine.

I have change my web.xml to <url-pattern>enterprise_web/ControllerServlet</url-pattern> and that works with Orion as well so I will keep that.

But I could not change to servlet/ControllerServlet => entrprise_web/servlet/ControllerServlet in the index.html like:
<!--Works with Orion <FORM ACTION="servlet/ControllerServlet" METHOD="POST">-->
<FORM ACTION="entrprise_web/servlet/ControllerServlet" METHOD="POST">
That did not work, not either at Orion.

In Orion I got 2 config files
server.xml
<application name="enterprise_web" path="../applications/enterprise_web.ear" />
and
default-web-site.xml
<web-app application="enterprise_web" name="enterprise_web" root="/enterprise_web" />
...Is there anything in JBoss that I have to configure??.

So if anyone could help me out I would be most happy!!!

Best regards
Fredrik

PS
I Use JBoss 3.0.4

The error is that when I try to connect to the servlet from the index.hml I just get the page can not be displayed.
Avatar billede arne_v Ekspert
27. november 2002 - 10:13 #1
If your JSP refer to servlet/ControllerServlet
and the JSP's are in the application root, then you must
must use:
  <url-pattern>servlet/ControllerServlet</url-pattern>

This is how it works.
Avatar billede arne_v Ekspert
27. november 2002 - 10:28 #2
With the current web.xml try change index.html GET link from:

<A HREF="entrprise_web/servlet/ControllerServlet?text=Detta är texten!">

to:

<A HREF="entrprise_web/ControllerServlet?text=Detta_ar_texten!">

because that is what you specified in the web.xml
file.

(and you can not have spaces in URL's - they need to
be encoded - you can use java.net.URLEncoder.encode for
that)
Avatar billede arne_v Ekspert
27. november 2002 - 10:33 #3
Og jeg synes stadigvæk at en mapping til
servlet/ControllerServlet giver mere mening
end til enterprise_web/ControllerServlet, når
man kigger på det absolutte URL's (når man
prefixer med applikationens navn):

/enterprise_web/servlet/ControllerServlet
/enterprise_web/enterprise_web/ControllerServlet

Den sidste er måske lige en tand for enterprise_web'et !

:-)
Avatar billede fredand Forsker
04. december 2002 - 15:24 #4
Hello Arne!

I think I made it with help from you. Now it works both at Orion and JBoss.
The only different there is this tag in teh HTML and JSP-files:

<HEAD>
    <BASE HREF="http://localhost/enterprise_web/">
    <!--<BASE HREF="http://localhost:8080/enterprise_web/">--><!--Orion-->
</HEAD>

Do you know if this can be removed an mange in som other way?

Could I just ask you to take a look at te ear file at  http://www.it-gymnasiet.info/programmering_c/enterprise_web.ear one last time and se if you could advise me to structure it in some better way?

Please answer in english.

Best regards
Fredrik
Avatar billede arne_v Ekspert
04. december 2002 - 15:36 #5
If JBoss (or more correct: the JSP/servlet container
bundled with JBoss) listens on port 8080, then the version
with :8080 should work with that as well.

What version of JBoss are you using ? And is it with
Tomcat or Jetty ?
Avatar billede arne_v Ekspert
04. december 2002 - 15:38 #6
I can look at your files this evening, when I get home.
Avatar billede fredand Forsker
04. december 2002 - 15:53 #7
Hello again!

I saw one misstake I wrote. I should be like this at JBoss

<HEAD>
    <BASE HREF="http://localhost:8080/enterprise_web/"><!--JBoss-->
</HEAD>
or at orion
<HEAD>
    <BASE HREF="http://localhost/enterprise_web/"><!--Orion-->
</HEAD>

So if yoy know how to aviod the BASE tag completly that would be great and if you could take a look at the structure.

By the way I use the BASE tag so I always can access src such as images like:
<IMAGE SRC="images/sitemap.jpg">
Both in HTML and JSP forwarded from servlets. Else I have to do like this in the JSP files forwaede from the servlet:
<IMAGE SRC="../images/sitemap.jpg">

Best Regrads Again!

Fredrik
Avatar billede arne_v Ekspert
04. december 2002 - 16:05 #8
OK, so it is JBoss that is running at 8080.

Basicly I just think that you should change that.

It should be very simple.

But it depends on whether it is JBoss+Tomcat
ot JBoss+Jetty you are running.
Avatar billede arne_v Ekspert
04. december 2002 - 21:29 #9
I download your example and it worked excellent with JBoss+Tomcat.

After I changed web.xml from:
            <url-pattern>servlet/ControllerServlet</url-pattern>
to:
            <url-pattern>/servlet/ControllerServlet</url-pattern>

Note that I run on port 8080 and the version I have downloaded
has:
        <BASE HREF="http://localhost:8080/enterprise_web/">

If I change that (remove the 8080) I need to change Tomcat from
port 8080 to port 80.

server.xml has a line:

<!--  Define a non-SSL Coyote HTTP/1.1 Connector on port 8080
  <Connector className="org.apache.catalina.connector.http.HttpConnector" port="8080" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="60000" />

that is easy to change from 8080 to 80.

If you are using JBoss with Jetty, then I am not sure how
to change port number, but I am sure that it can be done.
Avatar billede fredand Forsker
05. december 2002 - 08:56 #10
Hello!

Ok I see.

Thanks for all your help!

Now I understand this must better.

Best regards

Fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester