Scrivio Interview library
ScenarioAdvanced7 min read · updated 12 November 2026

You inherit an application on an old WebLogic or WebSphere server with EJBs and JNDI lookups. Outline a migration plan to Spring Boot.

Start by listing every feature the old server provides to the application, such as JNDI data sources, JMS queues, security realms, EJB timers and XA transactions, and pick a Spring Boot replacement for each. Then replace EJBs with Spring beans and @Transactional, replace JNDI lookups with injected configuration, and move the application in slices behind a proxy (the strangler pattern), with the same behaviour tests running against the old and the new version. Plan the javax to jakarta namespace change up front, because current Spring versions require it.

Why this question is asked

Many companies still run important systems on WebLogic or WebSphere, and the people who built them have often moved on. A senior engineer is expected to turn "we should get off this server" into a plan that does not break the business. Interviewers ask this question to see whether we know what an application server actually does for an application, and whether we can migrate without a risky big-bang rewrite. In this answer, we will recap what the old server provides, build an inventory of features in use, see how EJBs and JNDI lookups become Spring beans and configuration, migrate in slices with the strangler pattern, keep behaviour tests running against both versions, and plan for the javax to jakarta change.

1A Quick Recap of What the Old Server Does for Us

An application server such as WebLogic or WebSphere is a large runtime that hosts our application and gives it services. An EJB (Enterprise JavaBean) is a class that the server manages: the server creates it, pools it, wraps every call in a transaction and checks security before the method runs. JNDI (Java Naming and Directory Interface) is the server's phone book: the server registers resources such as a database connection pool under a name like jdbc/orders, and our code looks the resource up by that name.

So an old EJB application rarely works on its own. Its database connections, message queues, user logins, scheduled jobs and distributed transactions are all configured in the server's admin console, not in the code. That is why we cannot just copy the code into a Spring Boot project and run it. Spring Boot, a way of building a Spring application as a single runnable jar with an embedded web server, expects the application itself to own those things. The migration is really a move of responsibilities from the server into the application.

2Inventory the Server Features in Use

Before writing any code, we list what the server is doing for us. The fastest sources are the deployment descriptors (ejb-jar.xml, weblogic-ejb-jar.xml, ibm-ejb-jar-bnd.xml), the server configuration export, and a search of the code for InitialContext, @EJB, @Resource, @Schedule, MessageDrivenBean and UserTransaction. We also ask the operations team, because some features, such as a security realm connected to the company LDAP, are configured only on the server.

For each feature we write down how it is used and what replaces it. The table below shows the usual mapping. Notice that most rows are straightforward, but XA transactions and clustered timers need real design work, so we find them early.

Server features and their Spring Boot replacements
Server featureTypical useSpring Boot replacement
JNDI DataSourcejdbc/orders connection poolspring.datasource.* with HikariCP
JMS queues and MDBsOrder events, async workSpring JMS @JmsListener, or Kafka
Security realmLDAP login, rolesSpring Security with LDAP or OIDC
EJB timersNightly jobs@Scheduled with ShedLock, or Quartz
XA transactionsDB and queue in one commitJTA manager, or outbox pattern
Stateless session beansBusiness services@Service with @Transactional
XA transactions and clustered timers are the rows that need design, not just configuration.

The inventory also records who calls the application. Remote EJB clients using RMI/IIOP, the protocol old servers use to call EJBs on another machine, cannot call a Spring Boot service, so each of them needs a REST or messaging replacement and a migration date of its own.

3Replace EJBs and JNDI Lookups

A stateless session bean becomes a Spring bean. The container-managed transaction that the EJB got by default becomes @Transactional, and the JNDI lookup becomes a dependency that Spring injects. Here is a typical before and after.

Java
// Before: EJB with a JNDI lookup
@Stateless
public class OrderServiceBean implements OrderService {
public void place(Order o) throws Exception {
DataSource ds = (DataSource) new InitialContext().lookup("jdbc/orders");
try (Connection c = ds.getConnection()) { insert(c, o); } // runs in the container's transaction
}
}
// After: Spring bean, configuration injected
@Service
public class OrderService {
private final JdbcTemplate jdbc;
public OrderService(JdbcTemplate jdbc) { this.jdbc = jdbc; } // built from spring.datasource.*
@Transactional
public void place(Order o) {
jdbc.update("insert into orders(id, total) values (?, ?)", o.id(), o.total()); // 1 row
}
}
# application.yml
spring.datasource.url: jdbc:postgresql://db:5432/orders
spring.datasource.username: orders_app

Notice one behaviour difference. An EJB method is transactional by default (REQUIRED), even without an annotation. A Spring bean is not, so every EJB method needs an explicit @Transactional, or we silently lose transactions. Rollback rules are similar but not identical, since both roll back on unchecked exceptions by default, so we confirm them per method with tests.

4Migrate in Slices With the Strangler Pattern

Rewriting all of it and switching over on one weekend is the plan that fails most often. Instead, we put a proxy or API gateway in front of the old application, so that every request goes through it. Then we move one slice at a time, for example the order lookup screens first, to the new Spring Boot service, and change the proxy rule for those paths only. The old application keeps serving everything else. This is called the strangler pattern, after a vine that slowly grows around a tree until it replaces it.

A good first slice is read-only, often used and has few dependencies, so a mistake is visible and cheap to undo. Writes come later, and the slices that depend on XA transactions or remote EJB clients come last, when the team has experience.

Step throughOne slice through the strangler pattern
  1. Pick a sliceRead-only and well tested first
  2. Build it in Spring BootSame database, new code
  3. Run behaviour tests on bothOld and new must agree
  4. Route a small share via the proxyFor example 5 percent of traffic
  5. Errors and latency normal?
    YesRoute 100 percentNoRoute back to the old server
  6. Remove the old code for the sliceOnly after a stable period

6 steps in order. Play them, or step through them one at a time.

5Keep Behaviour Tests Running Against Both Versions

The only way to know that the new slice behaves like the old one is to test both with the same tests. We write black-box tests that call the HTTP endpoints or put messages on the queues and check the results in the database, without knowing which implementation answers. We run them against the old server first, which proves the tests describe today's behaviour, including its odd edge cases, and then against the new service.

For high-risk slices we can also replay a copy of real production requests against both versions and compare the answers, which catches differences the tests did not think of. The reason this matters so much is that old systems are full of undocumented behaviour that some client depends on.

6Plan for the javax to jakarta Change

Old WebLogic and WebSphere applications use the javax.* packages, such as javax.persistence and javax.servlet. When Java EE moved to the Eclipse Foundation and became Jakarta EE, the packages were renamed to jakarta.*. Spring Framework 6 and Spring Boot 3 and later, including Spring Boot 3.5 and 4.0, require the jakarta names, so every import, every XML descriptor that names classes, and every library that still uses javax must change.

Tools such as OpenRewrite recipes or the Eclipse Transformer do most of the renaming automatically. The harder part is third-party libraries that never published a jakarta version, which have to be upgraded or replaced. We should also plan the Java upgrade, because Spring Boot 3 needs at least Java 17, and an old server may still be on Java 8.

7Follow-up questions

Is it reasonable to run Spring inside WebLogic as an intermediate step?

Yes, and it is often a good first move. We can deploy a Spring application as a WAR on the existing server, use JndiDataSourceLookup or spring.datasource.jndi-name to reuse the server's connection pool and JtaTransactionManager to join its transactions. This lets us replace EJBs with Spring beans while the server still provides the infrastructure, and then later move to an embedded server when the server-specific features have been replaced.

How would you replace XA transactions?

First we ask whether we really need them. Many XA uses join a database update and a JMS send, and the transactional outbox pattern does the same job more simply: we write the message to an outbox table in the same database transaction and a separate process publishes it. If we truly need two-phase commit across resources, we can use a standalone JTA transaction manager such as Narayana or Atomikos with Spring Boot, but check your version for which integrations are supported.

8Conclusion

In this answer, we saw that an EJB application depends on many services of its application server, so the migration starts with an inventory of JNDI resources, JMS, security realms, timers and XA transactions, each with a chosen replacement. EJBs become Spring beans with explicit @Transactional, JNDI lookups become injected configuration, and the move happens slice by slice behind a proxy, with behaviour tests that run against both versions. The javax to jakarta rename and the Java upgrade are planned from the start rather than discovered halfway.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start with an inventory, because an EJB application leans on its server for much more than the code shows. I would go through the deployment descriptors, the server configuration and the code for JNDI lookups, and list the data sources, JMS queues and message-driven beans, security realms, EJB timers and any XA transactions, plus every remote EJB client.

Then, if they want more

For each one I would pick a Spring Boot replacement: spring.datasource properties instead of JNDI pools, @JmsListener instead of MDBs, Spring Security instead of the realm, @Scheduled with a lock or Quartz instead of timers, and either a JTA manager or the outbox pattern instead of XA.

In the code, stateless beans become @Service classes with explicit @Transactional, because Spring methods are not transactional by default the way EJB methods are, and lookups become constructor injection. I would not do a big-bang rewrite.

I would put a proxy in front of the old application and move one slice at a time, starting with something read-only, routing a small share of traffic first and keeping a quick way back. The same black-box behaviour tests would run against the old server and the new service, so we know they agree.

Finally, I would plan the javax to jakarta rename and the Java 17 or later upgrade up front, using OpenRewrite, because Spring Boot 3 and 4 require them.

About this answer

Last updated
12 November 2026
Versions it names
Spring Boot 3, Java 17, Java 8, Spring Boot 3.5
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Jakarta EE specifications
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "You inherit an application on an old WebLogic or WebSphere server with EJBs and JNDI...": https://scrivio-interview-library.netlify.app/java/jakarta-ee-platform/e69013c0fe/