LeoNicola
LeoNicola

Reputation: 1

WebLogic 14.1.2, Spring Boot 3.4.2, and Java 21 - Getting 404 Not Found after deploying the app

I am working on an application using WebLogic 14.1.2, Spring Boot 3.4.2, and Java 21. Initially, I was encountering the following error when deploying the app:

<Failure occurred in the execution of deployment request with ID "540210909400" for task "0" on [partition-name: DOMAIN]. Error is: "weblogic.application.ModuleException: java.lang.ClassNotFoundException: jakarta.servlet.jsp.tagext.DynamicAttributes"weblogic.application.ModuleException: java.lang.ClassNotFoundException: jakarta.servlet.jsp.tagext.DynamicAttributes
...
Caused By: java.lang.ClassNotFoundException: jakarta.servlet.jsp.tagext.DynamicAttributes
...

Solution: This issue was resolved by adding the following dependencies to the pom.xml file:

<dependency>
    <groupId>jakarta.servlet</groupId>
    <artifactId>jakarta.servlet-api</artifactId>
    <version>6.1.0</version>
</dependency>
<dependency>
    <groupId>jakarta.servlet.jsp</groupId>
    <artifactId>jakarta.servlet.jsp-api</artifactId>
    <version>3.1.1</version>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>

With this change, the application deployed successfully. However, when I try to access the endpoint http://localhost:7001/demoWebLogic/something/test, I get the following error:

Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.

Additional Attempts:

I tried adding the following dependencies to manage Jakarta EE versions but still got the 404 error:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-api</artifactId>
            <version>8.0.0</version><scope>provided</scope>
         </dependency>
     </dependencies>
</dependencyManagement>

and

<dependency>
    <groupId>jakarta.platform</groupId>
    <artifactId>jakarta.jakartaee-api</artifactId>
    <version>9.0.0</version>
</dependency>

But none of these worked.

Controller Code: Here is the code for my controller:

javaCopyEditimport lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/something")
public class Controller {
    @GetMapping(path = "/test", produces = "application/json;charset=UTF-8")
    public ResponseEntity<String> test() {
        return new ResponseEntity<>("Hello World", HttpStatus.OK);
    }
}

Note! I have an index.html in the webapp folder of the project, and when I access the following URL: http://localhost:7001/demoWebLogic/ The page is displayed normally without any issues. So, it seems the application is deployed correctly.

The steps I've tried to resolve the issue are already explained above.

Upvotes: 0

Views: 121

Answers (0)

Related Questions