urlhttp-status-code-404java-21spring-boot-3weblogic14c

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.


Solution

  • Please note that presently WebLogic 14.1.2 supports Java 17 and 21, Jakarta EE 8. WebLogic 14.1.2 does not support newer 3rd-party Java frameworks that use “jakarta” package names such as Spring 6.x or SpringBoot 3.x or Hibernate 5.5+.

    Oracle is planning to release WebLogic 15.1.1 in CY2025, which will support "Jakarta EE 9.1" and therefore will support applications using Spring 6.x or SpringBoot 3.x or Hibernate 5.5+.

    WebLogic 15.1.1 will support Java 17, 21, and 21 virtual threads, and "Jakarta EE 9.1". Therefore, it will provide support Spring 6.x or SpringBoot 3.x or Hibernate 5.5+ from an application perspective.

    So, you need to undo the changes in SpringBoot version 3.4.2 and comeback to a previous version 2.7.18.

    Kind Regards