Linux News

Cannot upload an image file possible through Tomcat 10

Linux Questions - Sun, 05/28/2023 - 05:12
The purpose of the code:

The following page code is intended to upload an image file (from the Windows desktop) to the Linux 8 server where the Tomcat 10 server is running.

My application name: TESTS
I have these libraries:
/u01/tomcat/base/middleware/tomcat10/webapps/TESTS/WEB-INF/lib;
commons-fileupload-1.5-test-sources.jar
commons-fileupload-1.5-tests.jar
commons-fileupload-1.5-sources.jar
commons-fileupload-1.5-javadoc.jar
commons-fileupload-1.5.jar

I have in my Tomcat 10 library:
/u01/tomcat/base/middleware/tomcat10/lib:
-rw-r--r--. 1 tomcat tomcat 365905 Apr 25 12:16 servlet-api.jar

The code:

<%@ page import="org.apache.commons.fileupload.*" %>
<%@ page import="org.apache.commons.fileupload.disk.*" %>
<%@ page import="org.apache.commons.fileupload.servlet.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="jakarta.servlet.*" %>
<%@ page import="jakarta.servlet.http.*" %>
<%@ page import="jakarta.sql.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory" %>
<%@ page import="org.apache.commons.fileupload.FileItemFactory" %>
<%
// Set the upload directory
String uploadDir = "/tmp/";
// Create a factory for disk-based file items
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// Parse the request
List<FileItem> items = upload.parseRequest(request);
// Process the uploaded items
Iterator<FileItem> iter = items.iterator();
while (iter.hasNext()) {
FileItem item = iter.next();
// If the item is a file, save it to the upload directory
if (!item.isFormField()) {
String fileName = new File(item.getName()).getName();
String filePath = uploadDir + fileName;
File uploadedFile = new File(filePath);
item.write(uploadedFile);
}
}
%>
<html>
<head>
<title>File Upload Example</title>
</head>
<body>
<h1>File Upload Example</h1>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file" />
<br />
<input type="submit" value="Upload" />
</form>
</body>
</html>

The error I get:

org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [24] in the jsp file: [/index.jsp]
The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from required type org.apache.commons.fileupload.servlet.ServletFileUpload
21: ServletFileUpload upload = new ServletFileUpload(factory);
22:
23: // Parse the request
24: List<FileItem> items = upload.parseRequest(request);
25:
26: // Process the uploaded items
27: Iterator<FileItem> iter = items.iterator();

It looks like:

https://www.linuxquestions.org/quest...-a-4175710078/
But this is a different case.

Does someone has any idea what the problem can be ?


Kind Regards
Categories: Software and Help

Encrypting page content

Linux Questions - Sun, 05/28/2023 - 05:08
I am working with CentOS 7, OEL 7, OEL 8.
Is there a way to encrypt ascii files (like a bash script) that contain code ? Is there also a way to decrypt it if necessary ?

Kind Regards.
Categories: Software and Help

LXer: KDE Plasma 6 Will Support Night Color on Wayland for NVIDIA Users

Linux Questions - Sun, 05/28/2023 - 03:06
Published at LXer:

The upcoming KDE Plasma 6 desktop environment series looks to offer support for the Night Color feature that automatically adjusts the color temperature of your screen to protect your eyes during long night computing sessions for users with NVIDIA graphics cards when using the Plasma Wayland session.

Read More...
Categories: Software and Help

KDE Plasma 6 Will Support Night Color on Wayland for NVIDIA Users

LXer Linux News - Sun, 05/28/2023 - 03:00
The upcoming KDE Plasma 6 desktop environment series looks to offer support for the Night Color feature that automatically adjusts the color temperature of your screen to protect your eyes during long night computing sessions for users with NVIDIA graphics cards when using the Plasma Wayland session.
Categories: General News

pipewire autostart

Linux Questions - Sun, 05/28/2023 - 02:31
/usr/sbin/pipewire-enable.sh does not provide /etc/rc.d script. It instead gives xdg autostart file. As a dwm user, how am I supposed to use it?
Categories: Software and Help

LXer: Microsoft has made Azure Linux generally available. Repeat, Azure Linux

Linux Questions - Sun, 05/28/2023 - 00:45
Published at LXer:

Come for the Kubernetes, stay for the containers. After using Azure Linux internally for two years and running it in public preview since October 2022, Microsoft this week finally made its distribution generally available.�

Read More...
Categories: Software and Help

Microsoft has made Azure Linux generally available. Repeat, Azure Linux

LXer Linux News - Sun, 05/28/2023 - 00:43
Come for the Kubernetes, stay for the containers. After using Azure Linux internally for two years and running it in public preview since October 2022, Microsoft this week finally made its distribution generally available.…
Categories: General News

lutris vulkan and diablo ii Resurrected

Linux Questions - Sun, 05/28/2023 - 00:35
I am trying to run Diablo II resurrected using lutris (which was installed from sbopkg) and have had
some success but have run into a problem with vulkan. Now slackware 15 64 bit multilib has vulkan-1.2.176.1 along with it's 32 bit compatibility package but i have only managed to build slackware
current's vulkan-sdk-1.3.204-x86_64-1.txz and not it's 32 bit compatibility package. Now my question
is how would i do that in this case. And yes the current 1.3.204 does get diablo II res. to work but
i would like to see if the compatibility package would help in this case and also for other games as
well. It seems only recently that the lutris logs started mentioning the need for a more recent
version of vulkan (1.3) and it seems to be effective in this case, granted said game tends
to break compatibility with lutris sometimes (possibly because it is patched frequently) but there
you have it.
Categories: Software and Help

How to completely erase an ssd drive?

Linux Questions - Sun, 05/28/2023 - 00:17
I have an old laptop. Using rsync, I back up everything I have that is important to me from my current laptop to my old laptop. I use the old laptop like a usb stick.

This year I will leave China and go back to England. I won't take the old laptop with me, it's too old.

I want to completely erase the ssd, write zeroes over everything. I want to wipe out everything.

How can I do that?

Not that I have any great secrets, but as a matter of principle.
Categories: Software and Help

LXer: Flatpak App of the Week: Cartridges, a Simple Launcher for All of Your Games

Linux Questions - Sat, 05/27/2023 - 22:36
Published at LXer:

Yes, our �Flatpak App of the Week� articles are back and this week I would like to introduce you to an app launched in March 2023 as a simple game launcher for all of your game accounts, Cartridges.

Read More...
Categories: Software and Help

Flatpak App of the Week: Cartridges, a Simple Launcher for All of Your Games

LXer Linux News - Sat, 05/27/2023 - 22:26
Yes, our “Flatpak App of the Week” articles are back and this week I would like to introduce you to an app launched in March 2023 as a simple game launcher for all of your game accounts, Cartridges.
Categories: General News

[SOLVED] inconsistent time storage

Linux Questions - Sat, 05/27/2023 - 21:45
My old laptop normally runs Slackware15/64, but it is a shared machine that also has a Windows 10 partition. I normally run the following script to set the hardware time and store it:

/etc/rc.d/rc.ntpd stop && ntpdate pool.ntp.org && hwclock --systohc --localtime && /etc/rc.d/rc.ntpd start

If the machine is there booted to windows, it will display the proper time, but returning to Slackware the time will have to be reset. What should I change to eliminate the discrepancy?

Thank you.
Categories: Software and Help

Greetings

Linux Questions - Sat, 05/27/2023 - 20:55
Good day, my name is Gerard and I am new to Linux. I hope to write LPIC-1 as soon as possible and I will need all the support I can get. Can anyone tell me which Linux distribution I should install to get started. Thanks
Categories: Software and Help

LXer: Debix Model B SBC targets industrial embedded applications

Linux Questions - Sat, 05/27/2023 - 20:12
Published at LXer:

The Debix Model B is a single board computer integrating the NXP i.MX8M Plus processor with 2.3 TOPs NPU and with extended operating temperature range. The new embedded device comes in a Raspberry Pi form-factor and offers similar peripherals.** The company states that the only difference between the Debix Model A launched last year and [�]

Read More...
Categories: Software and Help

Debix Model B SBC targets industrial embedded applications

LXer Linux News - Sat, 05/27/2023 - 20:09
The Debix Model B is a single board computer integrating the NXP i.MX8M Plus processor with 2.3 TOPs NPU and with extended operating temperature range. The new embedded device comes in a Raspberry Pi form-factor and offers similar peripherals.   The company states that the only difference between the Debix Model A launched last year and […]
Categories: General News

Unknown HTTP error on Pidgin Facebook

Linux Questions - Sat, 05/27/2023 - 19:56
Hello,

Recently I have been experiencing a strange problem with Pidgin.
When I try to connect to Facebook (I use purple-facebook) I get the error message: Unknown HTTP error
This happens on Devuan Chimaera, Debian Testing, and I even tried a live Fedora 35 iso.
I also tried different facebook accounts with the same result.
However, this doesn't happen 100% of the time, and occasionally it connects just fine.
I have been using the same setup for a long time, and never had any problem.
The system is up to date, and I use the latest purple-facebook library.
If I use a browser, I can access my facebook account without any problem and haven't noticed any trouble with other connections.

Any suggestions as to how address this issue?
Categories: Software and Help

LXer: Top 10 Debian-Based Linux Distributions for Everyone

Linux Questions - Sat, 05/27/2023 - 17:52
Published at LXer:

Comparison and feature highlights of ten Debian-based Linux distributions with their key offerings use cases and with a bonus list.

Read More...
Categories: Software and Help

Top 10 Debian-Based Linux Distributions for Everyone

LXer Linux News - Sat, 05/27/2023 - 17:51
Comparison and feature highlights of ten Debian-based Linux distributions with their key offerings use cases and with a bonus list.
Categories: General News

Problem with Ubuntu ISO

Linux Questions - Sat, 05/27/2023 - 16:24
I'm trying out different flavors of Linux on an old Toshiba Satellite laptop. I used Rufus 4.0 to burn the Linux Mint ISO to a flash drive, and it boots just fine. I was very favorably impressed with it, but wanted to give Ubuntu a try as well. Using the same process, that same laptop simply will not boot to Ubuntu. I get "453 out of range pointer oxaafff020 " error, and it bails out to boot Win 10 from the hard drive. Can anyone suggest another way to do this that will work?
Categories: Software and Help

How to Extract a .7z Compressed File from Terminal in Linux

Linux Today News - Sat, 05/27/2023 - 16:00

Using this guide, you’ll learn how to quickly extract a .7z compressed file from the terminal in Linux.

The post How to Extract a .7z Compressed File from Terminal in Linux appeared first on Linux Today.

Categories: General News

Pages