[JBoss JIRA] (WFLY-11956) @PostConstruct on @ApplicationScoped bean called too late in case @Valid is annotated on a business method
by Ronald Sigal (Jira)
[ https://issues.jboss.org/browse/WFLY-11956?page=com.atlassian.jira.plugin... ]
Ronald Sigal commented on WFLY-11956:
-------------------------------------
re: "I don't understand why any InjectionTarget method should trigger method-level validation? Or even call the method? Method-level validation should be performed when a method is invoked."
[~mkouba], actually, it's not method validation that is being triggered, it's field/property validation. Validating the "helloGreeting" property requires calling getHelloGreeting().
> @PostConstruct on @ApplicationScoped bean called too late in case @Valid is annotated on a business method
> ----------------------------------------------------------------------------------------------------------
>
> Key: WFLY-11956
> URL: https://issues.jboss.org/browse/WFLY-11956
> Project: WildFly
> Issue Type: Bug
> Components: Bean Validation, REST
> Affects Versions: 16.0.0.Final
> Reporter: Joerg Baesner
> Assignee: Ronald Sigal
> Priority: Major
> Attachments: logging.txt, playground.zip
>
>
> Having a bean class with {{@ApplicationScoped}}, which has a {{@PostConstruct}} and is implementing the following _Interface_:
> {code}
> @Path("/validated")
> public interface ValidatedJaxRsInterface {
>
> @GET
> @Valid
> @Produces(MediaType.APPLICATION_JSON)
> GreetingModel getHelloGreeting();
> }
> {code}
> will result in calling the {{getHelloGreeting}} method of the implementation class twice *_before_* the {{@PostConstruct}} is getting executed.
> This can be reproduced with the attached reproducer application...
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years, 3 months
[JBoss JIRA] (WFLY-11956) @PostConstruct on @ApplicationScoped bean called too late in case @Valid is annotated on a business method
by Ronald Sigal (Jira)
[ https://issues.jboss.org/browse/WFLY-11956?page=com.atlassian.jira.plugin... ]
Ronald Sigal commented on WFLY-11956:
-------------------------------------
There seem to be two issues.
1. As Christian has verified, it seems that getHelloGreeting() is getting called because A) it is a getter, and B) @Valid says that the returned GreetingModel should be validated, which means that getHelloGreeting() must be called.
[By the way, getHelloGreeting() is called twice by way of isCascadeRequired() and getCascadableValue() in the method validateCascadedConstraints() in org.hibernate.validator.internal.engine.ValidatorImpl:
{code}
if ( isCascadeRequired( validationContext, valueContext.getCurrentBean(), valueContext.getPropertyPath(), elementType ) ) {
Object value = getCascadableValue( validationContext, valueContext.getCurrentBean(), cascadable );
{code}
]
It seems to me that there should be a global way to prevent getters from being called. In fact, the default behavior is that getters are *not* called. But, beyond that, adding a META-INF/validation.xml with something like
{code}
<executable-validation>
<default-validated-executable-types>
<executable-type>CONSTRUCTORS</executable-type>
<executable-type>NON_GETTER_METHODS</executable-type>
</default-validated-executable-types>
</executable-validation>
{code}
should, I think, solve the problem. When I try that, though, it doesn't seem to help. [~guillaume.smet], can you comment on that?
2. The other issue is the fact that validation is instigated by JaxrsInjectionTarget.inject(). Probably I should check for the presence of a @PostConstruct annotated method, and, in its presence, start validation from JaxrsInjectionTarget.postConstruct(). So that's a fixable bug.
> @PostConstruct on @ApplicationScoped bean called too late in case @Valid is annotated on a business method
> ----------------------------------------------------------------------------------------------------------
>
> Key: WFLY-11956
> URL: https://issues.jboss.org/browse/WFLY-11956
> Project: WildFly
> Issue Type: Bug
> Components: Bean Validation, REST
> Affects Versions: 16.0.0.Final
> Reporter: Joerg Baesner
> Assignee: Ronald Sigal
> Priority: Major
> Attachments: logging.txt, playground.zip
>
>
> Having a bean class with {{@ApplicationScoped}}, which has a {{@PostConstruct}} and is implementing the following _Interface_:
> {code}
> @Path("/validated")
> public interface ValidatedJaxRsInterface {
>
> @GET
> @Valid
> @Produces(MediaType.APPLICATION_JSON)
> GreetingModel getHelloGreeting();
> }
> {code}
> will result in calling the {{getHelloGreeting}} method of the implementation class twice *_before_* the {{@PostConstruct}} is getting executed.
> This can be reproduced with the attached reproducer application...
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years, 3 months
[JBoss JIRA] (WFCORE-4436) NPE with the CLI embedded server when in admin-only mode
by James Perkins (Jira)
[ https://issues.jboss.org/browse/WFCORE-4436?page=com.atlassian.jira.plugi... ]
James Perkins updated WFCORE-4436:
----------------------------------
Priority: Blocker (was: Major)
> NPE with the CLI embedded server when in admin-only mode
> --------------------------------------------------------
>
> Key: WFCORE-4436
> URL: https://issues.jboss.org/browse/WFCORE-4436
> Project: WildFly Core
> Issue Type: Bug
> Components: Embedded
> Reporter: James Perkins
> Assignee: James Perkins
> Priority: Blocker
> Fix For: 9.0.0.Beta4
>
>
> Executing {{embed-server --admin-only=false}} will cause an NPE due to the fix in WFCORE-4358.
> {code}
> LogManager error of type FLUSH_FAILURE: Error on flush
> java.lang.NullPointerException
> at org.jboss.as.cli.embedded.ThreadLocalContextSelector.getStdioContext(ThreadLocalContextSelector.java:72)
> at org.jboss.stdio.StdioContext$1.getDelegate(StdioContext.java:148)
> at org.jboss.stdio.StdioContext$DelegatingPrintStream.write(StdioContext.java:264)
> at org.jboss.logmanager.handlers.UncloseableOutputStream.write(UncloseableOutputStream.java:44)
> at org.jboss.logmanager.handlers.UncloseableOutputStream.write(UncloseableOutputStream.java:44)
> at org.jboss.logmanager.handlers.UninterruptibleOutputStream.write(UninterruptibleOutputStream.java:84)
> at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
> at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
> at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
> at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
> at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
> at java.io.BufferedWriter.flush(BufferedWriter.java:254)
> at org.jboss.logmanager.handlers.WriterHandler.safeFlush(WriterHandler.java:170)
> at org.jboss.logmanager.handlers.WriterHandler.flush(WriterHandler.java:139)
> at org.jboss.logmanager.ExtHandler.doPublish(ExtHandler.java:105)
> at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:67)
> at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:77)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:333)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.Logger.logRaw(Logger.java:850)
> at org.jboss.logmanager.Logger.log(Logger.java:802)
> at org.jboss.logmanager.Logger.log(Logger.java:814)
> at org.jboss.logging.JBossLogManagerLogger.doLog(JBossLogManagerLogger.java:42)
> at org.jboss.logging.Logger.error(Logger.java:1518)
> at org.jboss.logging.DelegatingBasicLogger.error(DelegatingBasicLogger.java:714)
> at org.jboss.jca.deployers.common.AbstractDsDeployer.createObjectsAndInjectValue(AbstractDsDeployer.java:328)
> {code}
> This is like due to the TCCL being {{null}}. This can always be a possibility and should be checked for a {{null}} value.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years, 3 months
[JBoss JIRA] (WFCORE-4436) NPE with the CLI embedded server when in admin-only mode
by James Perkins (Jira)
[ https://issues.jboss.org/browse/WFCORE-4436?page=com.atlassian.jira.plugi... ]
James Perkins updated WFCORE-4436:
----------------------------------
Fix Version/s: 9.0.0.Beta4
> NPE with the CLI embedded server when in admin-only mode
> --------------------------------------------------------
>
> Key: WFCORE-4436
> URL: https://issues.jboss.org/browse/WFCORE-4436
> Project: WildFly Core
> Issue Type: Bug
> Components: Embedded
> Reporter: James Perkins
> Assignee: James Perkins
> Priority: Blocker
> Fix For: 9.0.0.Beta4
>
>
> Executing {{embed-server --admin-only=false}} will cause an NPE due to the fix in WFCORE-4358.
> {code}
> LogManager error of type FLUSH_FAILURE: Error on flush
> java.lang.NullPointerException
> at org.jboss.as.cli.embedded.ThreadLocalContextSelector.getStdioContext(ThreadLocalContextSelector.java:72)
> at org.jboss.stdio.StdioContext$1.getDelegate(StdioContext.java:148)
> at org.jboss.stdio.StdioContext$DelegatingPrintStream.write(StdioContext.java:264)
> at org.jboss.logmanager.handlers.UncloseableOutputStream.write(UncloseableOutputStream.java:44)
> at org.jboss.logmanager.handlers.UncloseableOutputStream.write(UncloseableOutputStream.java:44)
> at org.jboss.logmanager.handlers.UninterruptibleOutputStream.write(UninterruptibleOutputStream.java:84)
> at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
> at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
> at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
> at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
> at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
> at java.io.BufferedWriter.flush(BufferedWriter.java:254)
> at org.jboss.logmanager.handlers.WriterHandler.safeFlush(WriterHandler.java:170)
> at org.jboss.logmanager.handlers.WriterHandler.flush(WriterHandler.java:139)
> at org.jboss.logmanager.ExtHandler.doPublish(ExtHandler.java:105)
> at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:67)
> at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:77)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:333)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
> at org.jboss.logmanager.Logger.logRaw(Logger.java:850)
> at org.jboss.logmanager.Logger.log(Logger.java:802)
> at org.jboss.logmanager.Logger.log(Logger.java:814)
> at org.jboss.logging.JBossLogManagerLogger.doLog(JBossLogManagerLogger.java:42)
> at org.jboss.logging.Logger.error(Logger.java:1518)
> at org.jboss.logging.DelegatingBasicLogger.error(DelegatingBasicLogger.java:714)
> at org.jboss.jca.deployers.common.AbstractDsDeployer.createObjectsAndInjectValue(AbstractDsDeployer.java:328)
> {code}
> This is like due to the TCCL being {{null}}. This can always be a possibility and should be checked for a {{null}} value.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years, 3 months
[JBoss JIRA] (WFCORE-4436) NPE with the CLI embedded server when in admin-only mode
by James Perkins (Jira)
James Perkins created WFCORE-4436:
-------------------------------------
Summary: NPE with the CLI embedded server when in admin-only mode
Key: WFCORE-4436
URL: https://issues.jboss.org/browse/WFCORE-4436
Project: WildFly Core
Issue Type: Bug
Components: Embedded
Reporter: James Perkins
Assignee: James Perkins
Executing {{embed-server --admin-only=false}} will cause an NPE due to the fix in WFCORE-4358.
{code}
LogManager error of type FLUSH_FAILURE: Error on flush
java.lang.NullPointerException
at org.jboss.as.cli.embedded.ThreadLocalContextSelector.getStdioContext(ThreadLocalContextSelector.java:72)
at org.jboss.stdio.StdioContext$1.getDelegate(StdioContext.java:148)
at org.jboss.stdio.StdioContext$DelegatingPrintStream.write(StdioContext.java:264)
at org.jboss.logmanager.handlers.UncloseableOutputStream.write(UncloseableOutputStream.java:44)
at org.jboss.logmanager.handlers.UncloseableOutputStream.write(UncloseableOutputStream.java:44)
at org.jboss.logmanager.handlers.UninterruptibleOutputStream.write(UninterruptibleOutputStream.java:84)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.io.BufferedWriter.flush(BufferedWriter.java:254)
at org.jboss.logmanager.handlers.WriterHandler.safeFlush(WriterHandler.java:170)
at org.jboss.logmanager.handlers.WriterHandler.flush(WriterHandler.java:139)
at org.jboss.logmanager.ExtHandler.doPublish(ExtHandler.java:105)
at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:67)
at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:77)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:333)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:341)
at org.jboss.logmanager.Logger.logRaw(Logger.java:850)
at org.jboss.logmanager.Logger.log(Logger.java:802)
at org.jboss.logmanager.Logger.log(Logger.java:814)
at org.jboss.logging.JBossLogManagerLogger.doLog(JBossLogManagerLogger.java:42)
at org.jboss.logging.Logger.error(Logger.java:1518)
at org.jboss.logging.DelegatingBasicLogger.error(DelegatingBasicLogger.java:714)
at org.jboss.jca.deployers.common.AbstractDsDeployer.createObjectsAndInjectValue(AbstractDsDeployer.java:328)
{code}
This is like due to the TCCL being {{null}}. This can always be a possibility and should be checked for a {{null}} value.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years, 3 months
[JBoss JIRA] (WFLY-12002) Test connection -> WFLYJCA0047: Connection is not valid
by Brian Stansberry (Jira)
[ https://issues.jboss.org/browse/WFLY-12002?page=com.atlassian.jira.plugin... ]
Brian Stansberry reassigned WFLY-12002:
---------------------------------------
Component/s: JCA
Assignee: Stefano Maestri (was: Brian Stansberry)
> Test connection -> WFLYJCA0047: Connection is not valid
> -------------------------------------------------------
>
> Key: WFLY-12002
> URL: https://issues.jboss.org/browse/WFLY-12002
> Project: WildFly
> Issue Type: Bug
> Components: JCA
> Affects Versions: 16.0.0.Final
> Environment: Driver Class Name : org.postgresql.Driver
> Driver XA Datasource Class Name : org.postgresql.xa.PGXADataSource
> Driver Version : 9.4
> JDBC Compliant : false
> Reporter: daniel aguil
> Assignee: Stefano Maestri
> Priority: Minor
> Labels: connection, datasource
>
> Connection fail when test a postgresql datasource..
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years, 3 months