question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JAX-RS class hierarchy scanning is incomplete and creates transaction name explosion when using EJB

See original GitHub issue

Summary The JAX-RS class hierarchy scanning introduced in PR #493 does not work correctly when using EJB. EJB uses a $$$view<number> naming scheme when creating proxies, which do not get filtered out and leads to explosion of transaction names:

screenshot from 2019-03-04 15-18-38_crop screenshot from 2019-03-04 15-18-10_crop_blurred

Additional Info I’ve tried to fix it by simply adding a condition to the JaxRsTransactionNameInstrumentation matcher:

.and(not(ElementMatchers.<TypeDescription>nameContains("$view")))

That gets rid of the $$$view explosion, but all the requests still end up in the HttpServlet30Dispatcher transaction: screenshot_2019-03-05 httpservlet30dispatcher_dopost_blurred This shows that the current solution from PR elastic/apm-agent-java#493 is not sufficient. The problem probably comes up when dealing with generic hierarchies.

A Reproducible scenario We use a generic structure that might look complicated and intimidating at first glance, but that’s just because of the number of generic types used. We have an abstract generic endpoint, a concrete endpoint specialization, a generic endpoint/client interface and a concrete endpoint/client interface. To illustrate (Wildfly 9.0.2 btw):

  1. Concrete JaxRS Endpoint:
import javax.ejb.Singleton;

@Singleton
public class ConcreteEndpoint
        extends AbstractRequestEndpoint<ClassT, ClassU, ClassE, ClassV>
        implements ConcreteClient
  1. Concrete endpoint/client JaxRS web service interface definition:
@Path( "/" )
public interface ConcreteClient extends BaseRequestClient<ClassT, ClassU>
  1. Abstract JaxRS endpoint:
public abstract class AbstractRequestEndpoint<T extends Class1<?>, U extends Class2<?>, E extends Class3, V extends Class4<E, U>>
        implements BaseRequestClient<T, U>
  1. Generic JaxRS web service interface definition:
public interface BaseRequestClient<T extends Class1<?>, U extends Class2<?>>

Expected results We need to scan the complete jaxrs class hierarchy and find the @Path annotations, but ignore the view ejb proxies.

Maybe there are two separate issues, but I feel they are tightly coupled, so I’ve created just this one issue.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
eyalkorencommented, Mar 12, 2019

Maybe we miss them now because the avax.ws.rs.GET/POST/... annotations are used in the methods of the proxy classes that you excluded from instrumentation? If that’s the case, the solution would be to include them in the instrumentation but not use their class name, but the actual class name they are derived from.

0reactions
felixbarnycommented, Apr 26, 2019

Closed via #600

Read more comments on GitHub >

github_iconTop Results From Across the Web

exception EJB is already associated with an incomplete ...
The error means that two threads are attempting to call the same stateful session bean instance. A stateful session bean instance can only ......
Read more >
3. Resolved and Known Issues - Red Hat Customer Portal
An attempt to query the patch status of a JBoss EAP instance could previously result in an IllegalStateException error being thrown.
Read more >
RESTful Java with JAX-RS - ChercheInfo
JAX-RS is one of the latest generations of Java APIs that make use of Java annotations to reduce the need for standard base...
Read more >
Implementing RESTful views of EJB applications using JAX-RS
Using the EJB 3.1 specification, you have the option of exposing a local view of an enterprise bean without an explicit EJB local...
Read more >
Getting Started - jBPM Documentation
Pluggable transaction support with a default JTA implementation. ... This can be easily achieved by creating a JAX-RS compatible class (with JAX-RS ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found