JVMVRFY012: VerifyError for JSTL Tags - Foreach & Set tags - spring-mvc

IBM WAS: 8.5.5 Version
On JSP pages have & tags, I receive below error
Error 500: java.lang.Exception: java.lang.VerifyError: JVMVRFY012
stack shape inconsistent; class=com/ibm/_jsp/_desktop,
method=_jspx_meth_c_set_0(Ljavax/servlet/jsp/PageContext;)Z, pc=73;
Type Mismatch, argument 1 in signature
org/apache/jasper/el/ELContextWrapper.:(Ljavax/el/ELContext;Ljavax/el/FunctionMapper;)V
does not match Exception Details:
Location:
com/ibm/_jsp/_desktop._jspx_meth_c_set_0(Ljavax/servlet/jsp/PageContext;)Z
#73: JBinvokespecial Reason: Type
'org/apache/jasper/runtime/ProtectedFunctionMapper' (current frame,
stack[8]) is not assignable to 'javax/el/FunctionMapper'
Current Frame: bci: #73 flags: { } locals: { 'com/ibm/_jsp/_desktop',
'javax/servlet/jsp/PageContext', 'javax/servlet/jsp/JspWriter',
'org/apache/taglibs/standard/tag/rt/core/SetTag' } stack: {
'org/apache/taglibs/standard/tag/rt/core/SetTag', 'uninitialized',
'uninitialized', 'java/lang/String', 'javax/el/ExpressionFactory',
'uninitialized', 'uninitialized', 'javax/el/ELContext',
'org/apache/jasper/runtime/ProtectedFunctionMapper' } Stackmap Table:
append_frame(#128,Object[#127],Object[#231],integer)
On reading https://www.ibm.com/support/pages/ibm-java-linux-howto-resolving-javalangverifyerror-jvmvrfy012-stack-shape-inconsistent, understand that the reason could be
code is compiled against a different library than the one being used at runtime
a class tries to extend a class declared as final
a method tries to override a super method that is declared as final
a wrong argument is passed to a method
It does look to be #4 - but the same code works in Tomcat and does not work in IBM WAS and am unsure why WAS is passing an incorrect argument. Any suggestions on how we can resolve this issue?

You may want to explore Servlet/JSP version compatibility.
WAS: 8.5.5 reference
Servlet 3.0
JSP 2.2
If you happen to be using Spring Boot:
2.2.x and 2.1.x require Servlet 3.1+
2.0.x supports Servlet 3.0

This looks like a cross-linkage between the javax.el library in your application and the version packaged in the server. When using PARENT_LAST, any Java EE APIs you include in the application are loaded twice, once from the server and once from the application (because the application loader doesn't delegate that load to its parents). Depending on the other classes/packages in play, you can have an instance in which a class ends up directly referencing one instance of the class and indirectly (through some other reference) referencing the other instance, and the JVM will throw a VerifyError in that scenario.
The easiest answer: If you are not 200% sure you NEED the version of the javax.el classes in the app, remove them, and this specific error should be impossible. If you are definitely dependent on that version, then it becomes trickier, as it might require adding additional stuff to the application (to avoid picking stuff up from the server), or it may be that this specific library simply can't be safely overridden with PARENT_LAST loading. That analysis would require a deeper look at the error stack and possibly a dive into detail trace of the class loading.

Related

Multiple SpringBootTests using EmbeddedKafka fails with "only one 'RetryTopicConfigurationSupport'"

We have an application that makes use of Spring Kafka's non blocking retries via the RetryableTopic annotation.
We are in the middle of upgrading spring-kafka from 2.8.4 to 2.9.0.
We have several SpringBootTests that makes use of EmbeddedKafka. Each of these tests are marked with DirtyContext and AutoConfigureMockMvc
After upgrading, the first test would run fine, but the later test would fail to start the application with
Constructor threw exception; nested exception is java.lang.IllegalStateException: Only one 'RetryTopicConfigurationSupport' is allowed
I understand that the RetryTopicConfigurationSupport tries to ensures only one instance of itself is ever instantiated. So in the use case of running multiple unit tests, which includes multiple different SpringBootTests, how do we avoid hitting this problem?
I have tried marking the context dirty, but of course that didn't solve the problem as RetryTopicConfigurationSupport is using a static variable to track whether it has been instantiated before or not.
I have tried NOT marking the ContextDirty, but the later tests would fail to start the application because the Port is already in use.
Appreciate any advise!
Looks like this problem has been addressed in spring-kafka 3.0 and backported to 2.9.3
https://github.com/spring-projects/spring-kafka/issues/2477

How to output information about failure in a forward compatible way (extension hooks)?

The question I have here is about how to build in a forward compatible way the problem I am facing. Technically, I know how to do it in the current version (8.5, looking to move to 9 soon), but what is officially supported, seems to not satisfy the needs I have and my fear of course, is to be blocked in the future with my current approach.
I am currently using PHPUnit extension hooks. Pretty much following the same exact example we have in the documentation: https://phpunit.readthedocs.io/en/9.5/extending-phpunit.html
For the sake of simplicity, I'll paste a slightly modified version:
<?php declare(strict_types=1);
namespace Vendor;
use PHPUnit\Runner\AfterLastTestHook;
use PHPUnit\Runner\AfterTestFailureHook;
use PHPUnit\Runner\BeforeFirstTestHook;
class TestExtension implements BeforeFirstTestHook, AfterLastTestHook, AfterTestFailureHook
{
public function executeBeforeFirstTest(): void
{
echo 'Testing with configuration value';
}
public function executeAfterLastTest(): void
{
echo 'Second config value is OK!';
}
public function executeAfterTestFailure(string $test, string $message, float $time): void
{
echo "Failed test took $time seconds";
}
}
However, this triggers an awkward result:
PHPUnit 8.5.21 by Sebastian Bergmann and contributors.
Runtime: PHP 8.0.11 with Xdebug 3.0.4
Configuration: tests/unit.xml
Testing with configuration value....Failed test took 0.0055649280548096 seconds.. 6 / 6 (100%)Second config value is OK!
Time: 2.21 seconds, Memory: 38.00 MB
OK (6 tests, 9 assertions)
What I would like to do though, is much closer to what is possible to do with an instance of PHPUnit\Util\Printer which allows to append messages or information about the test and is render as part of the result. Upon failure, I would like to be able to see something along the lines of:
PHPUnit 8.5.21 by Sebastian Bergmann and contributors.
Runtime: PHP 8.0.11 with Xdebug 3.0.4
Configuration: /Users/sebastian.machuca/projects/cloud-dev-vm/bcappvm/codebases/bigcommerce/tests/unit.xml
Testing with configuration value......
Time: 47.63 seconds, Memory: 132.50 MB
There were 2 errors:
1) Vendor\Tests\TestMyClass::testSomeMethod
Failed test took 0.25880694389343 seconds
The problem here is that PHPUnit\Framework\TestListener is considered to be #deprecated and PHPUnit\Util\Printer is considered to be #internal with a clear "This class is not covered by the backward compatibility promise for PHPUnit" message.
So, again, the question here is about how to build in a forward compatible way. How could achieve the equivalent behaviour that today is possible with Printer Listeners, but using non internal and non deprecated functionality?
I don't know if it is possible to attach additional (structured) information to an error and extend the printer to take it into consideration.
If you're concerned about the command-line runner, a globally possible option might be to add output at the very end when the test-runner exits - at least for standard streams (e.g. stdout, standard output).
When you create the timing / error information, you pass them to another object you instantiate (e.g. on a static property or a different global variable) once that collects the messages/data.
That object's destructor is being called when PHP exits. You can then output the collected data more structured and for better reading (on standard output).
This does not answer on how to do it with Phpunit specifically, just saying so this is clearly stated and you're very much concerned about that. This is standard PHP behaviour.
For your interoperability problem, I'd wrap the functionality apart from how its triggered so that its more modular for future changes.
Next to that I'd check the Phpunit version and present a warning or similar so that if the version changes you get the chance to adopt if new functionality is available. Additionally you can pin the development utilities version with the repository (e.g. commmit composer.lock). Then it works what works and perhaps in the future there will be the interface you're looking for.
Unless you have to rely on what is available even if there isn't a backwards compatible promise for it.
And sure, there is always another option: Take part in the development in the Phpunit project and bring these things forward. Make it your own.

Finding status if MDB is running

I want to use mbeans on startup of j2ee application to check if all the MDBs are running and jms specification has been activated.
Any pointers will be very helpful
The only way I know of to do this would be to use the ServerEndpointControl MBean. This is a Liberty specific MBean for controlling the input sources for work into the runtime. This can also be used to get status on http listeners.
The best place to find the Javadoc for the MBean is here. To find out if an MBean is running you call the isPaused method providing the MDB name which is defined as:
ApplicationName#ModuleName#BeanName
if the MDB is running it'll return false.

Coroutine 'nokia.maps.map.render.p2d.Engine#_renderCo' aborted abnormally with exception

I've updated HereMaps JavaScript from 2.2.4 to 2.5.3 and the map has stopped working on Chrome (version 31.0.1650.57 m). Firefox and IE work as before.
On the console I see the message many times
Coroutine 'nokia.maps.map.render.p2d.Engine#_renderCo' aborted abnormally with exception base.js:158
TypeError: Cannot read property 'body' of undefined
Does anyone have a hint of what might be wrong?
Thanks.
It is very difficult to answer your specific problem without seeing your code, but I am able to produce a similar error which may help you track down your issue.
If you are getting multiple error messages, then it is likely that the JavaScript library itself is calling something periodically. From the text of the error it likely that the library is running a Coroutine, which is usually used for threading within the application.
The error I can produce is in a callback - if I add an overlay to the map, and deliberately try to access a non-existent property within my code I can get:
Coroutine 'nokia.maps.map.render.p2d.Engine#_renderCo' aborted abnormally with exception base.js:158
TypeError: Cannot read property 'bar' of undefined
This was because I added a typo as follows:
I changed the reference from foo.something.bar in the callback to foo.does_not_exist.bar. So I guess somewhere in your callbacks you are referencing foo.something.body in your callback - it could be in a listener for example.
Another possibility, is that you are switching directly to Display.SATELLITE when you are creating the map - this is no longer allowed:
Taken from the News feed on developer.here.com:
Breaking changes with 2.5.3
The new rendering engine requires the map to be initialized
asynchronously. If you want to change the center, zoom level or the
base map type the API now requires the application to wait for the
"displayready" event to be fired. This event is only fired once.
Please refer to the developer's guide (section "Beyond the Basic Map Application
") for details.

servlet initialization failure in websphere 6.0

I have many servlets in a web applicaton; for some stange reason, only and only one of them always fails in initialization with the following error trace:-
00000045 ServletWrappe E SRVE0100E: Did not realize init() exception thrown by servlet MyServletX: java.lang.NullPointerException
at com.ibm.ws.webcontainer.WebAppPmiListener.onServletStartInit(WebAppPmiListener.java:120)
at com.ibm.ws.webcontainer.webapp.FireOnServletStartInit.fireEvent(WebAppEventSource.java:237)
at com.ibm.ws.webcontainer.util.EventListeners.fireEvent(EventListeners.java:48)
at com.ibm.ws.webcontainer.webapp.WebAppEventSource.onServletStartInit(WebAppEventSource.java:105)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:261)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:444)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2841)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
I could not figure out if there is anything extra ordinary with this servlet. There is no init() method in this servlet and it extends HTTPServlet. Any idea what could be reason? I am using websphere server 6.0.x. How to get more debugging information in this case?
Well I don't know still cause of above error, but this is how it started working strangely:- i) Re-applied recommended fixes by IBM for my WAS version (especially there are IBM JDK upgrade related fix patches) ii) created a new profile of server iii) Install web application to new profile and it started working.
I don't think this is a product issue.
To debug this problem what i would suggest is to place a simple servlet (kind of Hello World) and deploy it to the server and see what happens.
initialization does not necessarily mean init() method alone.
If you have a static block in your servlet, if you have any variables that are initialized they would all be part of the initialization activity.
Look at the FFDC logs that were generated when this error occurred and that should provide you with clues.
As bkail mentioned, also ensure that yo have the latest fixpacks just to eliminate known problems with the product.
if the hello world servlet works, suggest you place hte servlet code here along with the SystemOut and System Err logs that correspond to this issue along with the relevant FFDC logs and i am sure most of us will be able to help you out with this
HTH
Manglu

Resources