I made a web-application with JSF 2.0. It supports german (default) and english, which is selected by the languages, sent in the http-header.
On my local server (Tomcat 6.0) the automatic language-selection was correct, if I had "german" on the highest priority, the application was german. The same for english.
But now I deployed it to my webserver (Tomcat 6.0 behind an Apache Webserver, using ModJk) and now it is only in english. But the http header is still the same:
Accept-Language: de-de,en-us;q=0.8,de;q=0.5,en;q=0.3
(Fetched from Firebug)
The entry for the language-packs in my faces-config.xml looks like this:
<application>
<locale-config>
<default-locale>de</default-locale>
<supported-locale>en</supported-locale>
</locale-config>
<resource-bundle>
<base-name>de.citkomm.tbm.locale.Lang</base-name>
<var>lang</var>
</resource-bundle>
</application>
Files "Lang.properties" and "Lang_en.properties" in de.citkomm.tbm.locale are correctly deployed.
Is this a problem with Apache + ModJk + Tomcat 6.0 or is something misconfigured? Does anyone have an idea why the wrong language is selected by Tomcat?
Thanks in advance!
That's strange... I would think that mod_jk should not affect this as you verify that the HTTP header still contains the correct Accept-Language. For a sanity-check if you are on the same internal network then you can try accessing the Tomcat web app directly and skip the Apache Web Server altogether, however I doubt this is the problem.
If you have any common libraries deployed on your Tomcat server environment then it is possible that a different version of your JSF implementation is being used, possibly an earlier version that has an internationalization bug.
I have seen this occur on application servers like JBoss and Glassfish that by default come prepackaged with their own JSF implementation. Likewise the JBoss/Glassfish classloaders gave preference to the bundled JSF implementation libraries versus any JSF implementations that appear in WEB-INF/lib.
Tomcat 6 however does not do this by default but I still suspect a classloading issue of some kind. Double check your common libraries and deployed libraries on the web server and verify that the correct JSF implementations exist there.
Well, I don't know why tomcat uses the evironment-variable of my Ubuntu Server, but it does.
Changed LANG from "en_US.UTF-8" to "de_DE.UTF-8" and now everything's fine. :S
Thanks anyway!
Related
I have configured and running a weblogic12C server (12.2.1.4.0) on my computer, and I am working with eclipe, where I have a spring boot application with java 1.8.
I need to configure ecplipse to deploy and debug on my local weblogic server.
The problem is that when trying to create the server in Eclipse and indicate what the server will be, its domain and the WAR to deploy, the wizzard says "The server does not support version 4.0 of the J2EE Web module specification."
The strange thing is that my client has a 12C weblogic server (12.2.1.3.0) and I can deploy there without problems via console (ip: 7001 / console).
Any ideas? Will it be a problem with the domain configuration?
Grateful for the answers !!
Some images speak more than a thousand words:
Configuration server weblogic wizzard
Selecting the domain
Indicating that it is a local domain
When trying to move the resource, the wizard tells me that it is not compatible
Checking the domain settings, I don't see anything wrong
According to this document
https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wbapp/basics.html#GUID-62B6050D-6DD3-4028-B863-4CD0B5692E7F
WebLogic Server fully supports HTTP servlets as defined in the Servlet 3.1 specification at http://jcp.org/en/jsr/detail?id=340. HTTP servlets form an integral part of the Java EE standard.
It looks like your Eclipse installation is trying to use Java EE version 4, which is not supported by Oracle Weblogic 12.2.1.*
Furthermore, I have found the below post, which I think could be useful to fix your issue.
Project facet Dynamic Web Module 4.0 is not supported by this server
That post explains the issue with Servlet-API version 4.0 and how to configure your IDE to use the version supported by Oracle Weblogic 12.2.1.*
I'm not new to servlets. But I'm still curious: why javax.servlet package isn't distributed on its own? Why I need some application server installed before I can compile my code?
Short answer, it is distributed separately.
Servlets are a specification and an API. If you want the JAR, download it from the spec site Servlet Spec 3.0.
Obviously if you want to actually deploy your application, you'll still need an implementation (i.e. a server).
The servlet API is available through some jar and you can do with it what you want. On maven it is here. You can compile the code without any application server but it probably won't do what you want. It is only an interface afterall
Servlets are only really relevant in the context of a Web Application and this is why Servlet Containers exist. They are the implementation. Take a look at all the work the container does before a request reaches the servlet: Tomcat Sequence Diagram.
Servlets like other Java EE technology like EJB are Specification from JSR(Java Specification Requests) from Java Community Process Program
The onus is on the Application Server vendor to provide the implementation based on the specifications released.In this case
- for Servlet 2.5
- for Servlet 3.0
Sun / now Oracle does release the javax.servlet package separately and you can download it from Maven Repository also its available within the lib folder of any J2ee complaint application server/web container .
i.e for Tomcat its available in TOMCAT_HOMEDIR/lib/servlet-api
So for developing and compiling , this jar is sufficient , you would only need the Application server only when you want to actually deploy your application.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to EJB 3.1 Deployment in Tomcat 5.5.x
Blockquote
Any buddy please help me i have an web space with apache tomcat 5.0 jsp 2.0 and jvm 1.6
and i want to use ejb in my project so please tell me what should i do that i can use ejb 3.1 in my web space which have these resources listed below
i) Tomcat - 5.5.xSupport
ii)JDK - 1.6.x Support
iii)JSP/servlet - 2.0 Support
so how can i use EJB with web application with this available resources i mean what should i do to these things
Please Help me...!!!
It's not possible, go download JBoss AS or GlassFish.
Tomcat implements just the web container part of Java EE
It's definitely possible and in some cases I prefer the option of using a lightweight container instead of a more heavy weight application server. Having said this though the version of Tomcat your using is too old and won't work anyway without some serious messing about with the container (changing some JARs that come preinstalled with Tomcat), even with that I'm not sure it will work.
As Bozho says, try OpnEJB, but go for JBoss or Glassfish if you can. Tomcat is a JSP container and therefore not meant to this kind of use. EJB run on Application servers.
Sorry, but I tried searching for this subject, but I didn't find related to my problem.
Recently, I bought a domain and web hosting for it. I bought it especially for using it for my Java projects.
I have Tomcat available as server on the hosting.
My question is: how do I work with a hosted Tomcat, which, in my opinion, it is quite different from localhost (where you could have unlimited access)?
For example, if I create a Spring project that looks like this:
project-name
src
war
index.jsp
WEB-INF
web.xml
The index.jsp outputs a simple This is a test
web.xml
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
I created an Ant build.xml that will build the project, but when I access from http://domain.com/project-name it will not work, and I only cand access the file from http://domain.com/project-name/war
If I had done this on localhost, I'd deploy it in tomcat-path/webapps, but how does this work online?
The solution is to install Tomcat Manager Webapp in order to deploy applications on a shared hosting that uses Tomcat as server.
EDIT:
If the hosting doesn't offer you Tomcat Manager (as was in my case), you can still make it through by asking the administrator of your hosting to configure your jk_mod file to deploy your war files.
Append these lines
jkMount /*.war ajp3
jkMount /* ajp3 ## I'm still not sure if this made it work, because it makes tomcat listen on the entire public_html
But be aware, if your version of Tomcat is brought to you by cPanel's EasyApache, you will have to deal with some issues there too - the latest installed Tomcat will be 5.5.33 (a bit old, right?), but again you can try tweaking the old version and install, let's say 6.x.x
A tutorial about this upgrade:
http://www.bestdesigns.co.in/blog/install-tomcat-6
The thing that help me a lot to understand the concepts that were envolved in solving this problem:
http://www.scribd.com/doc/6085698/Tomcat -- a training course about Tomcat and cPanel
An another thing to add: Install a local version of Tomcat on your machine, first deploy it on localhost. If there it works, it should be working online as well.
Those of you who work with Spring Roo, on Tomcat 5.5.33, if you already know, you cannot deploy your projects, becase of the too old Tomcat, so you have to upgrade your Tomcat immediately.
I hope this will help all of those who had difficulties like myself.
We're using Jboss, but we are really only using its JMS stuff. So, is there a way that I can trim down what's loaded when Jboss starts?
You can go for a servlet container (Tomcat) + a JMS provider (ex. ActiveMQ), without using an application server at all.
From 6 years ago, here's a blog entry about configuring JBoss with "just the right stuff."
I haven't used JBoss in a few years, but in v4.0, you could just drop the desired jar files into the deployment directory, and JBoss would load... only those jars.
The correct way to do this, is making a separate profile on your JBoss server that contains only the things needed to use JMS. JBoss v5 comes standard with several profiles: minimal, default, standard, all and web. Each of those starts other services. If you do not specify any profile, you're using the "default" profile.
You can create your own profile starting from a copy of the minimal profile and adding services as needed for JMS support.
The JBoss documentation contains a bit of information on what the files in those profile directories are used for. See Jboss server configurations.
You didn't specify which version of JBoss that you are using. Keep in mind that there are some changes in the configuration between JBoss v4 and JBoss v5/6. The referenced documentation in the answer from Cheeso points to JBoss v4.