Eric Malalel

Greenhorn
+ Follow
since Nov 18, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eric Malalel

I have complex SQL queries to write and i want to take advantage of Java 14 preview feature “text block”.
I have properly configured MyEclipse to use Java 14 using the –enable-preview parameter.
I have also added the –enable-preview parameter in Java Windows setting, and done what is recommended here: https://dev.dexterxx.pl/news/8

When I code my Java classes in MyEclipse, it’s fine, I can use text blocks.

However, when I build and run the application on Tomcat 9, I have the following error message:
java.lang.UnsupportedClassVersionError: Preview features are not enabled for com/knowledgeplaces/metalmsapi/SigninResource (class file version 58.65535). Try running with ‘–enable-preview’ (impossible de charger la classe [com.knowledgeplaces.metalmsapi.SigninResource])

Sounds like the feature is not enabled in the complied class file.

Please advise.
1 month ago
Thanks for taking time to put a detailed answer.
This is a Windows 2012 server and I use IIS 8.5 as front end of Tomcat 8, and it is very easy to define rewrite rules on IIS so domain of customer 1 is redirected to one tomcat instance on port 8080, and domain of customer N is redirected to another tomcat instance on another port.
Change in domain names are not so frequent so I can handle that too.
I do not deploy customer applications, I only deploy a solution that we have developed and rent to our customers, so taking care of URL is something we can handle too.
So it sounds it is worth doing this way.
On my current server, I have almost every two weeks a java error on permgen space. I hope I will get rid of it by setting java maxpermsize to 2 Go for each Tomcat instance, while I currently use 1 Go on my current server. Is this correct or do I need to set other parameters which may be useful to solve this issue?
5 years ago
I currently host customers applications on a single Tomcat instance on a server with 4 Go RAM.
I will upgrade and rent a new server with 32 Go RAM.
How can I leverage this RAM to serve more customers with the same server?
I was thinking of installing 10 Tomcat instances, each running its own JVM with up to 2 Go RAM.
is this a good idea?
If yes, how to do it? Especially, do I need specific configuration to have each Tomcat running in its own JVM ?
5 years ago
there is no filtering rules, but there is rewrite rules defined as follow :
5 years ago
JSP
I have cleared Chrome cache just before submitting the JSP and the JSP runs with no error, the file is downloaded on the server.
5 years ago
JSP
I am facing this weird issue.
I have a JSP on a server, which is used by an Apache Flex application to handle file uploads.
When I run the application from Chrome browser, everything works fine, files are uploaded on the server by the jsp.
When I run the same application from IE or Firefox browser, files don't get uploaded.
The JSP is hosted on a W2008/IIS 7 server and here is an extract from the log file:

For chrome, return code 200 so it works fine:
2015-10-19 09:02:41 91.121.80.191 POST /KPadmin20151/jsp/FileContentUpload.jsp resourcesDir=C:\LMS\resources\demo&filename=logoLynxWebSmall.PNG&X-ARR-CACHE-HIT=0&X-ARR-LOG-ID=262297aa-bac4-4cb1-b788-2ca04a1a7293 80 - 62.100.139.83 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2490.71+Safari/537.36 200 0 0 93

For IE/Firefox, return code 404, the jsp is not found and therefore uploads are not performed :
2015-10-19 08:57:25 91.121.80.191 POST /KPadmin20151/jsp/FileContentUpload.jsp resourcesDir=C:\LMS\resources\demo&filename=clean_urls.jpg 80 - 62.100.139.83 Shockwave+Flash 404 0 2 62

What do I need to change in my config? Why IIS returns a 404 instead of 200 when called from IE/Firefox instead of Chrome?

Any feedback appreciated.
5 years ago
JSP
Thanks, I hope you will find something. I have been googling the whole day and found nothing so far.
5 years ago
I don't use war files, each app is made of a set of folders and files, and I copy them under the root folder of the app and restart Tomcat, and it works fine.
If there is a "standard" folder structure for applications with different versions, what is this structure and how to configure it?
Or, if I want to use my structure, how do I name the context files, and what do I put in docbase and path parameters?
5 years ago
I use Tomcat 8 and have some problem to configure contexts for versioned applications.
I have a set of 4 applications: app1, app2, app3 and app4.
I know how to configure Tomcat to have these 4 applications running directly under webapps: I have folders webapps/app1, webapps/app2,... I define app1.xml, app2.xml,... and I place them in \Tomcat 8.0\conf\Catalina\localhost, and everything works fine.
Now I need to manage different versions of these 4 applications.
To do so:
I have organised my folders like this: webapps/v1/app1, webapps/v1/app2,...,webapps/v2/app1, webapps/v2/app2,..
Based on https://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Defining_a_context:
I have defined new context files named v1#app1.xml, v2#app2.xml,..., and I place them in \Tomcat 8.0\conf\Catalina\localhost.
In each of this file, I have set docbase and path, for instance for V1 of app1 I have:
docBase="${catalina.home}/webapps/v1/app1" path="/app1"
When I restart Tomcat, my applications do not start.
I have propably made one or more mistakes, but English is not my native language and Tomcat doc is not very clear, especially for docbase and path.
So if someone can help me to configure this correctly, thanks in advance.
5 years ago
I have developed an application which currently uses a JNDI datasource 'myAppDB'.
I have now installed mutiple instances of this application, each one for a different organization, on my Tomcat server.
Each instance is accessed by a specific domain name, such as orgN.mydomain.com, and each instance has its own context definition, where 'myAppDB' is mapped to the MySQL database name to be used by the instance of the application, such as myDB-N'.
I would like to simplify my infrastructure with only one Tomcat application and one context, with minimum or even no code change.
Is it possible to map the context based on domain name used to access the application, for instance:
when org1.mydomain.com, JNDI datasource myAppDB will map to database DB1
when org2.mydomain.com, JNDI datasource myAppDB will map to database DB2
5 years ago
I have developed a Tomcat application acting as a kind of CMS, where all the contents are stored in a subfolder of my Tomcat application named 'contents'.

I currently use a JNDI Realm configured to use the 'user' table of my application and which protects this folder, so users need to be connected to my application to see the contents.
But this is not sufficient, since my application gives the ability to define detailed access rights for each user, such as:
'user1' can access 'content1' at any time, and 'content2' only during july 2015.
'user2' can access 'content3' only during july 2015.

The problem with the current JNDI Realm is:
Once 'user1' is connected, if he knows how to use browser development tools, he will be able to give to 'user2' the URL of 'content1' and 'content2'.
And when 'user2' will be connected, he will be able to access 'content1' and 'content2' by entering the URL in another tab of the browser, since he has been authenticated by the JNDI Realm.

JAASRealm could be a solution if I can implement a custom logic where I get the URL requested by the user, and I check in my CMS database if the user has appropriate rights to access this URL at this moment.

Is this possible, and how? Tomcat doc at https://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#JAASRealm is a bit weird for me.

If not, what would be alternative solutions?

For instance, I am also wondering if I could put this folder 'contents' in a cloud (Google, Microsoft, AWS), and configure this cloud storage so it is only accessible from my application. I know really few things about clouds .

Please advise.
5 years ago
We have a Java/Adobe Flex 3 application which was running well on the following infrastructure:
Windows Server 2003 32 bits / IIS 6 / Apache Tomcat 5.5 / JRE 1.6.0_12 / MySQL 5.0.24 / MySQL JDBC Connector 5.0.24

Our server crashed, and our server provider told us Windows Server 2003 was no longer available, so we had to reinstall the server with the following infrastructure :
Windows Server 2008 64 bits / IIS 7 / Apache Tomcat 8.0 64 bits / JRE 1.8.0_31 / MySQL 5.6 64 bits / MySQL JDBC Connector 5.1.34

And then we deployed the Java/Adobe Flex 3 applcation on this new infrastructure. It runs well, but after 20 to 30 minutes of not so intensive usage, the application hangs and no longer responds, and when we take a look at Tomcat logs, we see things like this:

17-Apr-2015 17:33:32.263 SEVERE [http-nio-8080-exec-104] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [KPuser2] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@32e8b4bc]) and a value of type [flex.messaging.io.TypeMarshallingContext] (value [flex.messaging.io.TypeMarshallingContext@2bbd846f]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
17-Apr-2015 17:33:32.263 SEVERE [http-nio-8080-exec-104] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [KPuser2] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@13c83d29]) and a value of type [flex.messaging.HttpFlexSession] (value [flex.messaging.HttpFlexSession@8cf25af]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
17-Apr-2015 17:33:32.263 SEVERE [http-nio-8080-exec-104] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [KPuser2] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@656ece67]) and a value of type [flex.messaging.io.Java15TypeMarshaller] (value [flex.messaging.io.Java15TypeMarshaller@12d4db22]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
17-Apr-2015 17:33:32.263 SEVERE [http-nio-8080-exec-104] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [KPuser2] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@c86570d]) and a value of type [flex.messaging.MessageBroker] (value [flex.messaging.MessageBroker@5ef502c1]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
17-Apr-2015 17:33:32.264 SEVERE [http-nio-8080-exec-104] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [KPuser2] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@32002e21]) and a value of type [flex.messaging.config.SystemSettings] (value [flex.messaging.config.SystemSettings@266b8d98]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
17-Apr-2015 17:33:32.264 SEVERE [http-nio-8080-exec-104] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [KPuser2] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@5c2b9362]) and a value of type [flex.messaging.io.SerializationContext] (value [flex.messaging.io.SerializationContext@5b1bb4e5]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

What are memory leaks?
We have memory leaks with the new infrastructure but not previously (I suppose). Is it an application issue or a configuration issue?
How to investigate and correct these memory leaks?

Thanks in advance.
5 years ago
Thanks for the tip. I have been through the documentation and set up a memory realm. It works but not exactly as expected. Now, whether I access the page directly with its URL or through the Tomcat application, I get the login form which protects access to this page.

I would like to configure the Tomcat application so, whoever is logged in the application, the application is seen as "userX", userX beeing granted access through the memory realm.

Is it possible, and how?
11 years ago
i have a tomcat application running fine under IIS6, Tomcat 5.5.2 and Jakarta Redirector.
Once connected with a userid and password, this application is using a rich interface build with Adobe Flex to display HTML pages in iframes which are dynamically created and deleted by the application.
these HTML pages (and other stuff like flash swf files called by these HTML pages) are stored in a "content" folder which is located under the root folder of the tomcat application.
the problem is that currently the user can directly access the html pages without login to the application. he just needs to type "http://application_URL/contents/page.html " and he can see it.
which configuration should i use so this is no longer possible and people can see the html pages only once connected to the tomcat application?
11 years ago