How Can Change Default Locale For TOMCAT In WINDOWS?

user2049371 picture user2049371 · Jan 16, 2016 · Viewed 11.2k times · Source

As can be seen in photos، Iran is set location.

enter image description here

i used realm tag in "%CATALINA_HOME%\conf\server.xml".

 <Realm  className="org.apache.catalina.realm.JDBCRealm"
                driverName="oracle.jdbc.driver.OracleDriver"
                connectionURL="jdbc:oracle:thin:@localhost:1521:xe"
                connectionName="Arash" connectionPassword="who"
                userTable="users" userNameCol="USER_NAME" userCredCol="USER_PASS"
                userRoleTable="USER_ROLES" roleNameCol="ROLE_NAME"  />

When TOMCAT runs and connect to the database,The following error is given.

java.sql.SQLException: Locale not recognized
    at oracle.jdbc.driver.T4CTTIoauthenticate.setSessionFields(T4CTTIoauthenticate.java:1059)
    at oracle.jdbc.driver.T4CTTIoauthenticate.<init>(T4CTTIoauthenticate.java:261)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:565)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564)
    at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:663)
    at org.apache.catalina.realm.JDBCRealm.startInternal(JDBCRealm.java:726)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:155)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:899)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:155)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:155)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:769)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:155)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:649)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)

I put this Code in "%CATALINA_HOME%\bin\catalina.bat"

set -Duser.language=en -Duser.country=US

Still, the error occurs.

Answer

Sandeep Poonia picture Sandeep Poonia · Jan 16, 2016

Instead of setting country, you need to set the region of the user. So the correct Java options would be: -Duser.language=en -Duser.region=US