huge amount of +~JF****.tmp files in /var/cache/tomcat7/temp - tomcat7

In my tomcat temp folder, I have 2.5Gb of +~JF****.tmp files, the file sizes are either ~750K or ~23M
$ pwd
/var/cache/tomcat7/temp
$ ls -lt
-rw------- 1 tomcat tomcat 23278008 06:47 5 Th08 +~JF2247741302721424357.tmp
-rw------- 1 tomcat tomcat 773236 06:47 5 Th08 +~JF2626850872018060030.tmp
-rw------- 1 tomcat tomcat 750984 06:47 5 Th08 +~JF6955350201064404318.tmp
-rw------- 1 tomcat tomcat 23278008 06:34 5 Th08 +~JF5760450811263657816.tmp
...
I did you searching for this problem but all I found is about Jasper Report font problem which doesn't make sense to me, my project is not using Jasper.
do you have any idea why?
thanks

We are facing a similar problem and I would like to share what I found:
java.awt.Font.createFont(int i, java.io.InputStream in) generates a temporary file with a name +~XXXX.tmp (where XXXX is a long number).
When the JVM ends, all these files are deleted.
The problem arises when the JVM ends abruptly, as it doesn't delete temporary files, or for long-running JVM (i.e.: Tomcat production server).
What we did was just change the font creation method and use:
java.awt.Font.createFont(int i, java.io.File f)
With this method a temporary file is not created anymore.

Related

How to update the configuration files in WAS Liberty once after deployment Can it not be like Tomcat web server?

After deploying WAR file in WAS Liberty container, I try to edit one of the configuration file under “WEB-INF” folder by stopping and again restarting the WAS liberty server. However, I cannot use updated information and it uses the old configuration which was used during initial deployment.
If you put .war it is automatically expanded each time the server starts. However you can also use 'expanded deployment' and put unpacked .war to the apps folder. In that case you will be able to modify files on the fly without rewrites during restarts. Check this link for more details.
Continue with this issue ... and thank you for your replies for this question.
I am looking for solution where it will unpack WAR file automatically like tomcat,WAS,etc… and we can update and use the information after this WAR extraction.
I checked autoexpand option and made it false. Now after making this changes, WAR file is not getting extracted in the apps folder.
Actually, we can use this solution as workaround i.e. need to enable the auto expand option in the server.xml. This will expand/extract the WAR file. Then need to stop the Liberty server. Now, update server.xml and disable the auto expand option. After that we need to update the required configuration file. Then need to start the server. This actually work, but this cannot be solution.
I am looking for solution like tomcat web server, where after deploying war file, we can make changes inside webapps/xx/WEB-INF/ path for further configuration settings.
Thank you for your reply!!
Please find the requirement details.
WAR file is deployed # /opt/Liberty/wlp/usr/servers/TCLiberty/apps/
-rw-r--r-- 1 clsqa cls 43358874 Apr 5 17:21 TC-DEV-4.3.war
This file will get extracted # /opt/Liberty/wlp/usr/servers/TCLiberty/apps/expanded/
/opt/Liberty/wlp/usr/servers/TCLiberty/apps/expanded>ls
drwxr-x--- 10 clsqa cls 4096 Apr 11 14:53 TC-DEV-4.3.war
/opt/Liberty/wlp/usr/servers/TCLiberty/apps/expanded>ls -ltr TC-DEV-4.3.war
total 60
-rw-r----- 1 clsqa cls 1555 Feb 28 01:53 index.html
drwxr-x--- 3 clsqa cls 4096 Apr 11 14:53 ..
drwxr-x--- 2 clsqa cls 4096 Apr 11 14:53 META-INF
drwxr-x--- 9 clsqa cls 4096 Apr 11 14:53 images
drwxr-x--- 2 clsqa cls 4096 Apr 11 14:53 logs
drwxr-x--- 8 clsqa cls 4096 Apr 11 14:53 WEB-INF
drwxr-x--- 3 clsqa cls 4096 Apr 11 14:53 css
drwxr-x--- 2 clsqa cls 12288 Apr 11 14:53 html
drwxr-x--- 10 clsqa cls 4096 Apr 11 14:53 .
drwxr-x--- 2 clsqa cls 12288 Apr 11 14:53 js
drwxr-x--- 2 clsqa cls 4096 Apr 11 14:53 pdf
The WAR file extraction was done automatically since we have made auto expand = true
<!-- Enable features -->
<featureManager>
<feature>webProfile-8.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
httpPort="9080"
httpsPort="9443"
host="*" />
<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>
<webApplication contextRoot="TC-DEV-4.3" location="TC-DEV-4.3.war" />
<mimeTypes>
<type>.htc=text/x-component</type>
</mimeTypes>
Now my requirement is to make changes in file which is available in “/opt/Liberty/wlp/usr/servers/TCLiberty/apps/expanded/TC-DEV-4.3.war/WEB-INF/”
/opt/Liberty/wlp/usr/servers/TCLiberty/apps/expanded/TC-DEV-4.3.war/WEB-INF>ls TMS.properties
-rw-r----- 1 clsqa cls 2789 Apr 2 2010 TMS.properties
Content of this file are some predefined variables (constants)and ip address(variable) of the application and corresponding port. This IP address is always different which need to modified depending upon the application server and ports of the environment
appaddrlist=//:
In order to make this files changes, I need to stop the Liberty server. But when I restart the server again, the existing WAR file will be extracted in the “expanded” path. And I lose my changes.
Now, as per our discussion and solution provided, I can make server.xml file and make changes of autoexpand option to false. In this case TMS.property file will not be overwritten and my issue is resolved.
However, I believe this solution as workaround because every time I need to modify the server.xml file.
Is there any other solution? Earlier I had given reference of the tomcat web server where we can make changes in the WEB-INF folder after auto extraction by tomcat server.
Request to guide in this regards.
Thanks

My metasploit module(s) not found/loading

Any custom metasploit module I create isn't getting loaded.
I tried both of these demos:
https://www.offensive-security.com/metasploit-unleashed/building-module/ https://github.com/rapid7/metasploit-framework/wiki/Loading-External-Modules
and got the same result that the modules were NOT found.
Before posting here, I checked these out:
https://forums.kali.org/showthread.php?28940-Metasploit-modules-not-loading!
https://www.offensive-security.com/metasploit-unleashed/modules-and-locations
and from SO:
I can't get new modules to load in metasploit
How to add module in Metasploit?
no help
Just working with the github example, on the Kali host, I do indeed have the file in the right location (according to the demo):
root#kali:~/.msf4/modules/exploits/test# ls -al
total 12
drwxr-xr-x 2 root root 4096 Mar 19 13:59 .
drwxr-xr-x 3 root root 4096 Mar 19 13:58 ..
-rw-r--r-- 1 root root 9 Mar 19 13:59 test_module.rb
I then ran reload_all and when using this command:
use exploit/test/test_module it returns with Failed to load module.
I also tried to manually load that path and it failed too:
msf > loadpath ~/.msf4/modules/
Loaded 0 modules:
Posting the answer for anyone who may come across this. I'm kinda new to this; didn't know where metasploit info gets logged.
It's in: ~/.msf4/logs/framework.log
The log told me I had a syntax error... must have happened from copying and pasting the text from the browser. Cleaned that up and everything works.

Windows using hidden file rather than directory in paths...Why?

I (and my colleague) are having this problem with 32-bit applications on a 64-bit Windows 7 OS. We have also found the same problems when we invoke a 64-bit application and pass a path as described below as a parameter in cmd.exe.
Given the path "C:\dir1\dir2\file1.txt", we have some 32-bit applications that don't appear to be able to consistently resolve that path and find the file if there is a hidden file of a particular naming structure causing it to lose it's way.
For example, given the directory/file structure:
\dir1
\dir2
\file1.txt
\.dir2Blah
Of importance is that the "hidden" file's name starts with the same characters as those which indicate a directory at that same level of the hierarchy. What comes after that in the hidden file's name is irrelevant. It could be called ".dir2Whatever".
The problem is that more often than not (but not consistently always) some 32-bit applications we use can't find the file1.txt file. We're told it can't be found or it doesn't exist, etc. in the application. Using Process Monitor, we found the reason appears to be that while the path being asked for is C:\dir1\dir2\file1.txt, the path being evaluated by the the Windows system is C:\dir1\.dir2Blah\file1.txt.
We have found that some 32-bit applications appear to be able to work fine with those (what I would call) erroneous paths and successfully find the files in question but others do not.
As I said above, we have also found we can reproduce the problem with 64-bit applications if we try to open the file through a cmd.exe prompt; for example, "textpad.exe \dir1\dir2\file1.txt".
We've "googled" this problem for 2 days because we're completely stumped and cannot believe that no one else has ever encountered this if it's so "easy" to reproduce. My colleague and I are both able to cause the failure; not consistently, but file access will fail more than half the time when we set up the structure I described.
I've included a picture of Process Monitor showing this failure in two applications but succeeding in a third...here.
Can anyone tell me what is going on? First, why is it changing the path to use that hidden file rather than the directory name provided? And, more importantly, how can we make it stop ;-)?
Cheers,
jtm
Added later:
Here's the "dir /x" output for a directory where I'm having this problem.
24/05/2017 12:17 PM <DIR> .
24/05/2017 12:17 PM <DIR> ..
24/05/2017 12:17 PM 12 BLAHTS~1 .blahtst
23/05/2017 03:06 PM 104 JSHINT~1 .jshintrc
24/05/2017 12:16 PM <DIR> blah
24/05/2017 12:16 PM 0 blank.txt
24/05/2017 12:15 PM 6,624 INDEX~1.HTM index.html
24/05/2017 10:48 AM <DIR> js
It also indicates how we stumbled on the problem. I have an html file that is trying to load a JavaScript file under the /js directory, but there is also a .jshintrc file at the same level and my old Apache server can't find the files to serve them. If I remove the .jshintrc file, I can get around this, but this project isn't one I created and I'm leery of just removing things willy nilly.

Maven error: Could not find or load main class .usr.share.maven.boot.plexus-classworlds-2.x.jar

I have recently upgraded my Ubuntu from 14.04 to 16.04 and started getting the following error when running any mvn commands (version 3.3.9): Error: Could not find or load main class .usr.share.maven.boot.plexus-classworlds-2.x.jar. My environment variables are declared as follows:
$JAVA_HOME: /usr/lib/jvm/java-8-oracle
$PATH: /usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$M2_HOME: /usr/share/maven
$M2: /usr/share/maven/bin
When trying to find a solution, I've tried removing the M2 and M2_HOME variables as suggested on various threads, which resulted in getting a different error: Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher. I have also tried running apt-get remove --purge maven and installing it again as well as downloading the .tar.gz archive, but in both cases, nothing has changed.
When looking into the /usr/share/maven/boot folder, there is a chain of symlinks pointing from plexus-classworlds-2.x.jar -> /usr/share/java/plexus-classworlds2-2.5.2.jar. Am I missing some dependencies? Or are there any old configuration files that did not get removed by --purge?
EDIT: When I execute mvn as root, I get the Launcher error instead of plexus-classworlds-2.x. Also, I have completely removed and reinstalled all plexus libraries, yet with no change.
Check if /usr/share/maven/boot has multiple jars with pattern /usr/share/maven/boot/plexus-classworlds-*.jar.
Mine was something like:
drwxr-xr-x 2 root root 4096 Dec 23 14:21 ./
drwxr-xr-x 6 root root 4096 Nov 14 2015 ../
-rw-r--r-- 1 root root 52684 Dec 12 2015 plexus-classworlds-2.5.2.jar
lrwxrwxrwx 1 root root 34 Dec 10 2015 plexus-classworlds-2.x.jar -> ../../java/plexus-classworlds2.jar
This messes up /usr/share/maven/bin/mvn bash script and executes a wrong java command.
I had to remove the jar and leave only the symbolic link.

H2 Database - restore configurations in console

In the H2 console I clicked the 'Remove' button on the configurations. After several reinstall's these options are not restored so now my only option is a generic JNDI datasource which I don't want.
How do I restore them?
I am using a Mac.
There is a file in your home called .h2.server.properties.
This stores the config and can be removed and then reinstalled to repopulate this.
The configuration file h2.server.properties is located in {userHome} / delete it and re-execute your project, the plugin recreates the file again with the configuration restored.
Go to the home directory and find this file:
$ cd ~
$ ls -alh | grep "h2"
-rw-r--r-- 1 chaklader staff 1.9K Nov 1 18:02 .h2.server.properties
Open this file .h2.server.properties in your VSCode or any other editor. Copy this whole file or only the 2 rows that provides the H2 info:
#H2 Server Properties
#Mon Nov 01 18:53:17 BDT 2021
webSSL=false
webAllowOthers=false
webPort=8082
10=Generic DB2|com.ibm.db2.jcc.DB2Driver|jdbc\:db2\://localhost/test|
11=Generic Oracle|oracle.jdbc.driver.OracleDriver|jdbc\:oracle\:thin\:#localhost\:1521\:XE|sa
12=Generic MS SQL Server 2000|com.microsoft.jdbc.sqlserver.SQLServerDriver|jdbc\:microsoft\:sqlserver\://localhost\:1433;DatabaseName\=sqlexpress|sa
13=Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc\:sqlserver\://localhost;DatabaseName\=test|sa
14=Generic PostgreSQL|org.postgresql.Driver|jdbc\:postgresql\:test|
15=Generic MySQL|com.mysql.jdbc.Driver|jdbc\:mysql\://localhost\:3306/test|
16=Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc\:hsqldb\:test;hsqldb.default_table_type\=cached|sa
17=Generic Derby (Server)|org.apache.derby.jdbc.ClientDriver|jdbc\:derby\://localhost\:1527/test;create\=true|sa
18=Generic Derby (Embedded)|org.apache.derby.jdbc.EmbeddedDriver|jdbc\:derby\:test;create\=true|sa
19=Generic H2 (Embedded)|org.h2.Driver|jdbc\:h2\:~/test|sa
0=Generic JNDI Data Source|javax.naming.InitialContext|java\:comp/env/jdbc/Test|sa
1=Generic Teradata|com.teradata.jdbc.TeraDriver|jdbc\:teradata\://whomooz/|
2=Generic Snowflake|com.snowflake.client.jdbc.SnowflakeDriver|jdbc\:snowflake\://accountName.snowflakecomputing.com|
3=Generic Redshift|com.amazon.redshift.jdbc42.Driver|jdbc\:redshift\://endpoint\:5439/database|
4=Generic Impala|org.cloudera.impala.jdbc41.Driver|jdbc\:impala\://clustername\:21050/default|
5=Generic Hive 2|org.apache.hive.jdbc.HiveDriver|jdbc\:hive2\://clustername\:10000/default|
6=Generic Hive|org.apache.hadoop.hive.jdbc.HiveDriver|jdbc\:hive\://clustername\:10000/default|
7=Generic Azure SQL|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc\:sqlserver\://name.database.windows.net\:1433|
8=Generic Firebird Server|org.firebirdsql.jdbc.FBDriver|jdbc\:firebirdsql\:localhost\:c\:/temp/firebird/test|sysdba
9=Generic SQLite|org.sqlite.JDBC|jdbc\:sqlite\:test|sa
20=Generic H2 (Server)|org.h2.Driver|jdbc\:h2\:mem\:testdb|sa
Restart the H2 database and in the console you will need to provide the correct URL if you have any custom properties:
spring.jpa.show-sql=true
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:testdb
Try with the Generic H2 (Server) and you should be login now.

Resources