Hostname problem with Wildfly 10 and RabbitMQ JDNI configuration - java

I'm following this documentation to configure JNDI for Wildfly 10 with RabbitMQ
https://www.rabbitmq.com/jms-client.html
The reason i'm using JNDI is to my application has no dependency with any JMS Provider's library. It means, in my application, i use javax.jms-api-2.0.jar only for integration with RabbitMQ or ActiveMQ... later.
This is my configuration in Wildfly standalone.xml file.
<object-factory name="java:global/jms/ConnectionFactory1" module="com.rabbitmq.jms"
class="com.rabbitmq.jms.admin.RMQObjectFactory">
<environment>
<property name="className" value="javax.jms.ConnectionFactory"/>
<property name="virtualHost" value="/"/>
<property name="host" value="rabbitmq_server"/>
<property name="port" value="5672"/>
</environment>
</object-factory>
This is the soure code for integration.
Context context = new InitialContext();
ConnectionFactory connectionFactory
= (ConnectionFactory) context.lookup("java:global/jms/ConnectionFactory1");
if (connectionFactory == null) {
System.out.println("Cannot initiallize connection factory.");
return;
}
Connection connection = connectionFactory.createConnection(
"guest",
"guest");
if (connection == null) {
System.out.println("Initiallize connection failed.");
return;
}
Session session = connection.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);
if (session == null) {
System.out.println("Initiallize session failed.");
return;
}
My problem is:
At this configuration,
If i set the value is IP address => it is ok
If I set the value is hostname (already mapping with IP address in my hosts file) => it always create connection to localhost.
Anyone has faced with this issue before?
12:00:12,318 ERROR [stderr] (default task-15) com.rabbitmq.jms.util.RMQJMSException: RabbitMQ connection was refused. RabbitMQ broker may not be available.
12:00:12,319 ERROR [stderr] (default task-15) at com.rabbitmq.jms.admin.RMQConnectionFactory.instantiateNodeConnection(RMQConnectionFactory.java:170)
12:00:12,319 ERROR [stderr] (default task-15) at com.rabbitmq.jms.admin.RMQConnectionFactory.createConnection(RMQConnectionFactory.java:117)
12:00:12,319 ERROR [stderr] (default task-15) at com.mypackage.web.servlet.WhiteListRegistration.test(WhiteListRegistration.java:68)
12:00:12,320 ERROR [stderr] (default task-15) at com.mypackage.web.servlet.WhiteListRegistration.processRequest(WhiteListRegistration.java:106)
12:00:12,320 ERROR [stderr] (default task-15) at com.mypackage.web.servlet.WhiteListRegistration.doPost(WhiteListRegistration.java:180)
12:00:12,320 ERROR [stderr] (default task-15) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
12:00:12,321 ERROR [stderr] (default task-15) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
12:00:12,321 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
12:00:12,321 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
12:00:12,322 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
12:00:12,322 ERROR [stderr] (default task-15) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
12:00:12,323 ERROR [stderr] (default task-15) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
12:00:12,323 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
12:00:12,324 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
12:00:12,325 ERROR [stderr] (default task-15) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
12:00:12,325 ERROR [stderr] (default task-15) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
12:00:12,326 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
12:00:12,326 ERROR [stderr] (default task-15) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
12:00:12,327 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
12:00:12,327 ERROR [stderr] (default task-15) at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
12:00:12,327 ERROR [stderr] (default task-15) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
12:00:12,327 ERROR [stderr] (default task-15) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
12:00:12,328 ERROR [stderr] (default task-15) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
12:00:12,328 ERROR [stderr] (default task-15) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
12:00:12,328 ERROR [stderr] (default task-15) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
12:00:12,329 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
12:00:12,380 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
12:00:12,381 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
12:00:12,381 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
12:00:12,381 ERROR [stderr] (default task-15) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
12:00:12,381 ERROR [stderr] (default task-15) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
12:00:12,381 ERROR [stderr] (default task-15) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
12:00:12,381 ERROR [stderr] (default task-15) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
12:00:12,381 ERROR [stderr] (default task-15) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
12:00:12,382 ERROR [stderr] (default task-15) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
12:00:12,382 ERROR [stderr] (default task-15) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
12:00:12,382 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
12:00:12,383 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
12:00:12,383 ERROR [stderr] (default task-15) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
12:00:12,384 ERROR [stderr] (default task-15) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
12:00:12,384 ERROR [stderr] (default task-15) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
12:00:12,385 ERROR [stderr] (default task-15) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
12:00:12,386 ERROR [stderr] (default task-15) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
12:00:12,387 ERROR [stderr] (default task-15) at java.lang.Thread.run(Thread.java:748)
12:00:12,391 ERROR [stderr] (default task-15) Caused by: java.net.ConnectException: Connection refused: connect
12:00:12,392 ERROR [stderr] (default task-15) at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
12:00:12,393 ERROR [stderr] (default task-15) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
12:00:12,394 ERROR [stderr] (default task-15) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
12:00:12,394 ERROR [stderr] (default task-15) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
12:00:12,394 ERROR [stderr] (default task-15) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
12:00:12,396 ERROR [stderr] (default task-15) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
12:00:12,397 ERROR [stderr] (default task-15) at java.net.Socket.connect(Socket.java:589)
12:00:12,398 ERROR [stderr] (default task-15) at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:60)
12:00:12,398 ERROR [stderr] (default task-15) at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:62)
12:00:12,398 ERROR [stderr] (default task-15) at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:156)
12:00:12,398 ERROR [stderr] (default task-15) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1106)
12:00:12,399 ERROR [stderr] (default task-15) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1063)
12:00:12,434 ERROR [stderr] (default task-15) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1021)
12:00:12,434 ERROR [stderr] (default task-15) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1182)
12:00:12,435 ERROR [stderr] (default task-15) at com.rabbitmq.jms.admin.RMQConnectionFactory.instantiateNodeConnection(RMQConnectionFactory.java:159)
12:00:12,435 ERROR [stderr] (default task-15) ... 43 more

Ya, i just found out that the hostname cannot contains some special character such as _.
Then i removed this from rabbitmq_server to rabbitmqserver then everything is good now.
Hope someone get the issue like me can fix it follow this.

Related

Encountering IllegalArgumentException in Jboss EAP

I'm miograting an app in our server, from Websphere to JBoss EAP7.
The app is working fine in the Webspehere server but when we migrate in in JBoss, we are encountering an exception upon logging in the app.
java.lang.IllegalArgumentException: org.infinispan.commons.ma rshall.NotSerializableException
Here is the stacktrace of the error.
2019-05-28 17:17:38,161 ERROR [stderr] (default task-7) java.lang.IllegalArgumentException: org.infinispan.commons.ma rshall.NotSerializableException: ph.com.crm.common.admin.ListLovListVO
2019-05-28 17:17:38,162 ERROR [stderr] (default task-7) at org.wildfly.clustering.web.infinispan.session.coar se.CoarseSessionAttributes.setAttribute(CoarseSessionAttributes.java:63)
2019-05-28 17:17:38,162 ERROR [stderr] (default task-7) at org.wildfly.clustering.web.undertow.session.Distri butableSession.setAttribute(DistributableSession.java:147)
2019-05-28 17:17:38,162 ERROR [stderr] (default task-7) at io.undertow.servlet.spec.HttpSessionImpl.setAttrib ute(HttpSessionImpl.java:169)
2019-05-28 17:17:38,162 ERROR [stderr] (default task-7) at ph.com.crm.modules.security.LoginProcessor.t oHomePage(LoginProcessor.java:803)
2019-05-28 17:17:38,162 ERROR [stderr] (default task-7) at ph.com.crm.modules.security.LoginProcessor.p erformTask(LoginProcessor.java:327)
2019-05-28 17:17:38,162 ERROR [stderr] (default task-7) at ph.com.crm.modules.security.LoginProcessor.e xecute(LoginProcessor.java:146)
2019-05-28 17:17:38,162 ERROR [stderr] (default task-7) at ph.com.crm.modules.security.ActionListener.e xecute(ActionListener.java:41)
2019-05-28 17:17:38,162 ERROR [stderr] (default task-7) at ph.com.common.servlet.CommonServlet.performT ask(CommonServlet.java:289)
2019-05-28 17:17:38,163 ERROR [stderr] (default task-7) at ph.com.common.servlet.CommonServlet.doPost(C ommonServlet.java:82)
2019-05-28 17:17:38,163 ERROR [stderr] (default task-7) at javax.servlet.http.HttpServlet.service(HttpServlet .java:707)
2019-05-28 17:17:38,163 ERROR [stderr] (default task-7) at javax.servlet.http.HttpServlet.service(HttpServlet .java:790)
2019-05-28 17:17:38,163 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletHandler.handle Request(ServletHandler.java:85)
2019-05-28 17:17:38,163 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.ServletSecur ityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
2019-05-28 17:17:38,163 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletDispatchingHan dler.handleRequest(ServletDispatchingHandler.java:36)
2019-05-28 17:17:38,163 ERROR [stderr] (default task-7) at org.wildfly.extension.undertow.security.SecurityCo ntextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
2019-05-28 17:17:38,163 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:43)
2019-05-28 17:17:38,163 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.SSLInformati onAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
2019-05-28 17:17:38,164 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.ServletAuthe nticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
2019-05-28 17:17:38,164 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:43)
2019-05-28 17:17:38,164 ERROR [stderr] (default task-7) at io.undertow.security.handlers.AbstractConfidential ityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
2019-05-28 17:17:38,164 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.ServletConfi dentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
2019-05-28 17:17:38,164 ERROR [stderr] (default task-7) at io.undertow.security.handlers.AuthenticationMechan ismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
2019-05-28 17:17:38,164 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.CachedAuthen ticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
2019-05-28 17:17:38,164 ERROR [stderr] (default task-7) at io.undertow.security.handlers.NotificationReceiver Handler.handleRequest(NotificationReceiverHandler.java:50)
2019-05-28 17:17:38,165 ERROR [stderr] (default task-7) at io.undertow.security.handlers.AbstractSecurityCont extAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
2019-05-28 17:17:38,165 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:43)
2019-05-28 17:17:38,165 ERROR [stderr] (default task-7) at org.wildfly.extension.undertow.security.jacc.JACCC ontextIdHandler.handleRequest(JACCContextIdHandler.java:61)
2019-05-28 17:17:38,165 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:43)
2019-05-28 17:17:38,165 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:43)
2019-05-28 17:17:38,165 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler .handleFirstRequest(ServletInitialHandler.java:285)
2019-05-28 17:17:38,165 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler .dispatchRequest(ServletInitialHandler.java:264)
2019-05-28 17:17:38,166 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler .access$000(ServletInitialHandler.java:81)
2019-05-28 17:17:38,166 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler $1.handleRequest(ServletInitialHandler.java:175)
2019-05-28 17:17:38,166 ERROR [stderr] (default task-7) at io.undertow.server.Connectors.executeRootHandler(C onnectors.java:202)
2019-05-28 17:17:38,166 ERROR [stderr] (default task-7) at io.undertow.server.HttpServerExchange$1.run(HttpSe rverExchange.java:792)
2019-05-28 17:17:38,166 ERROR [stderr] (default task-7) at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1149)
2019-05-28 17:17:38,166 ERROR [stderr] (default task-7) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
2019-05-28 17:17:38,167 ERROR [stderr] (default task-7) at java.lang.Thread.run(Thread.java:748)
2019-05-28 17:17:38,167 ERROR [stderr] (default task-7) Caused by: org.infinispan.commons.marshall.NotSerializableExc eption: ph.com.crm.common.admin.ListLovListVO
2019-05-28 17:17:38,167 ERROR [stderr] (default task-7) java.lang.Exception: org.infinispan.commons.marshall.NotSeria lizableException: ph.com.crm.common.admin.ListLovListVO
2019-05-28 17:17:38,168 ERROR [stderr] (default task-7) at ph.com.crm.modules.security.LoginProcessor.t oHomePage(LoginProcessor.java:809)
2019-05-28 17:17:38,168 ERROR [stderr] (default task-7) at ph.com.crm.modules.security.LoginProcessor.p erformTask(LoginProcessor.java:327)
2019-05-28 17:17:38,168 ERROR [stderr] (default task-7) at ph.com.crm.modules.security.LoginProcessor.e xecute(LoginProcessor.java:146)
2019-05-28 17:17:38,168 ERROR [stderr] (default task-7) at ph.com.crm.modules.security.ActionListener.e xecute(ActionListener.java:41)
2019-05-28 17:17:38,168 ERROR [stderr] (default task-7) at ph.com.common.servlet.CommonServlet.performT ask(CommonServlet.java:289)
2019-05-28 17:17:38,168 ERROR [stderr] (default task-7) at ph.com.common.servlet.CommonServlet.doPost(C ommonServlet.java:82)
2019-05-28 17:17:38,169 ERROR [stderr] (default task-7) at javax.servlet.http.HttpServlet.service(HttpServlet .java:707)
2019-05-28 17:17:38,169 ERROR [stderr] (default task-7) at javax.servlet.http.HttpServlet.service(HttpServlet .java:790)
2019-05-28 17:17:38,169 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletHandler.handle Request(ServletHandler.java:85)
2019-05-28 17:17:38,169 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.ServletSecur ityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
2019-05-28 17:17:38,169 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletDispatchingHan dler.handleRequest(ServletDispatchingHandler.java:36)
2019-05-28 17:17:38,169 ERROR [stderr] (default task-7) at org.wildfly.extension.undertow.security.SecurityCo ntextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
2019-05-28 17:17:38,169 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:43)
2019-05-28 17:17:38,170 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.SSLInformati onAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
2019-05-28 17:17:38,170 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.ServletAuthe nticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
2019-05-28 17:17:38,170 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:43)
2019-05-28 17:17:38,170 ERROR [stderr] (default task-7) at io.undertow.security.handlers.AbstractConfidential ityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
2019-05-28 17:17:38,170 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.ServletConfi dentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
2019-05-28 17:17:38,170 ERROR [stderr] (default task-7) at io.undertow.security.handlers.AuthenticationMechan ismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
2019-05-28 17:17:38,170 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.CachedAuthen ticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
2019-05-28 17:17:38,171 ERROR [stderr] (default task-7) at io.undertow.security.handlers.NotificationReceiver Handler.handleRequest(NotificationReceiverHandler.java:50)
2019-05-28 17:17:38,171 ERROR [stderr] (default task-7) at io.undertow.security.handlers.AbstractSecurityCont extAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
2019-05-28 17:17:38,171 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:43)
2019-05-28 17:17:38,171 ERROR [stderr] (default task-7) at org.wildfly.extension.undertow.security.jacc.JACCC ontextIdHandler.handleRequest(JACCContextIdHandler.java:61)
Any inputs would be appreciated thanks!
JVM says this is an issue:
2019-05-28 17:17:38,161 ERROR [stderr] (default task-7) java.lang.IllegalArgumentException: org.infinispan.commons.ma rshall.NotSerializableException: ph.com.crm.common.admin.ListLovListVO
2019-05-28 17:17:38,167 ERROR [stderr] (default task-7) Caused by: org.infinispan.commons.marshall.NotSerializableExc eption: ph.com.crm.common.admin.ListLovListVO
2019-05-28 17:17:38,167 ERROR [stderr] (default task-7) java.lang.Exception: org.infinispan.commons.marshall.NotSeria lizableException: ph.com.crm.common.admin.ListLovListVO
Is that dependency from your project? Is it part of your pom.xml? Or was it carried over from WebSphere, assuming that it'd be part of JBOSS?
I already fixed it by adding implements Serialization in my class specifically in ListLovListVO.

Download file from a remote server with Rest API using JAX RS

I need to download file from a remote server using JAX RS and this is my code:
package rest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
#Path("/restwb")
public class FileResource {
#GET
#Path("/{companyName}/{Type}/{cl}/{fname}")
#Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response downloadFile(#PathParam("fname") String fileName, #PathParam("companyName") String CompName,
#PathParam("Type") String Type, #PathParam("cl") String cl) throws FileNotFoundException {
Response response = null;
try {
File file = new File(getClass().getClassLoader()
.getResource(CompName + "/" + Type + "/" + cl + "/" + fileName + ".png").getFile());
FileInputStream inputStream = new FileInputStream(file);
ResponseBuilder rb = Response.ok(inputStream);
rb.header("Content-Disposition", "attachment; filename=" + file.getName());
response = rb.build();
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
}
My Question is how can i save an image in my remote server and then to download it.I test it in localhost it work correctly but if i test it in remote server i can 't to save and download.
2019-03-11 13:20:48,385 INFO
[com.sun.jersey.server.impl.application.WebApplicationImpl]
(ServerService Thread Pool -- 71) Initiating Jersey application,
version 'Jersey: 1.19.2 08/25/2016 12:00 AM' 2019-03-11 13:20:49,300
INFO [org.wildfly.extension.undertow] (ServerService Thread Pool --
71) WFLYUT0021: Registered web context: /RestWS 2019-03-11
13:20:49,321 INFO [org.jboss.as.server] (External Management Request
Threads -- 7) WFLYSRV0010: Deployed "RestWS.war" (runtime-name :
"RestWS.war") 2019-03-11 13:24:54,763 ERROR [stderr] (default task-8)
java.io.FileNotFoundException:
/content/RestWS.war/WEB-INF/classes/Intercable/IOS/Iphone/a_red.png
(No such file or directory) 2019-03-11 13:24:54,764 ERROR [stderr]
(default task-8) at java.io.FileInputStream.open0(Native Method)
2019-03-11 13:24:54,764 ERROR [stderr] (default task-8) at
java.io.FileInputStream.open(FileInputStream.java:195) 2019-03-11
13:24:54,764 ERROR [stderr] (default task-8) at
java.io.FileInputStream.(FileInputStream.java:138) 2019-03-11
13:24:54,764 ERROR [stderr] (default task-8) at
rest.FileResource.downloadFile(FileResource.java:43) 2019-03-11
13:24:54,765 ERROR [stderr] (default task-8) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2019-03-11
13:24:54,765 ERROR [stderr] (default task-8) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2019-03-11 13:24:54,765 ERROR [stderr] (default task-8) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2019-03-11 13:24:54,765 ERROR [stderr] (default task-8) at
java.lang.reflect.Method.invoke(Method.java:498) 2019-03-11
13:24:54,765 ERROR [stderr] (default task-8) at
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
2019-03-11 13:24:54,765 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
2019-03-11 13:24:54,768 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
2019-03-11 13:24:54,768 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
2019-03-11 13:24:54,768 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
2019-03-11 13:24:54,768 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
2019-03-11 13:24:54,768 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
2019-03-11 13:24:54,768 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
2019-03-11 13:24:54,768 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
2019-03-11 13:24:54,768 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
2019-03-11 13:24:54,769 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
2019-03-11 13:24:54,769 ERROR [stderr] (default task-8) at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
2019-03-11 13:24:54,769 ERROR [stderr] (default task-8) at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
2019-03-11 13:24:54,769 ERROR [stderr] (default task-8) at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
2019-03-11 13:24:54,769 ERROR [stderr] (default task-8) at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)
2019-03-11 13:24:54,769 ERROR [stderr] (default task-8) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
2019-03-11 13:24:54,769 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
2019-03-11 13:24:54,769 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
2019-03-11 13:24:54,769 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
2019-03-11 13:24:54,770 ERROR [stderr] (default task-8) at
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
2019-03-11 13:24:54,770 ERROR [stderr] (default task-8) at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2019-03-11 13:24:54,770 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
2019-03-11 13:24:54,770 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
2019-03-11 13:24:54,770 ERROR [stderr] (default task-8) at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2019-03-11 13:24:54,770 ERROR [stderr] (default task-8) at
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
2019-03-11 13:24:54,770 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
2019-03-11 13:24:54,770 ERROR [stderr] (default task-8) at
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
2019-03-11 13:24:54,771 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
2019-03-11 13:24:54,771 ERROR [stderr] (default task-8) at
io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
2019-03-11 13:24:54,771 ERROR [stderr] (default task-8) at
io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
2019-03-11 13:24:54,772 ERROR [stderr] (default task-8) at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2019-03-11 13:24:54,772 ERROR [stderr] (default task-8) at
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
2019-03-11 13:24:54,772 ERROR [stderr] (default task-8) at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2019-03-11 13:24:54,772 ERROR [stderr] (default task-8) at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
2019-03-11 13:24:54,772 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
2019-03-11 13:24:54,772 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
2019-03-11 13:24:54,772 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
2019-03-11 13:24:54,773 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
2019-03-11 13:24:54,773 ERROR [stderr] (default task-8) at
io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
2019-03-11 13:24:54,773 ERROR [stderr] (default task-8) at
io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
2019-03-11 13:24:54,773 ERROR [stderr] (default task-8) at
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
2019-03-11 13:24:54,773 ERROR [stderr] (default task-8) at
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
2019-03-11 13:24:54,773 ERROR [stderr] (default task-8) at
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
2019-03-11 13:24:54,773 ERROR [stderr] (default task-8) at
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
2019-03-11 13:24:54,773 ERROR [stderr] (default task-8) at
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
2019-03-11 13:24:54,774 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
2019-03-11 13:24:54,774 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
2019-03-11 13:24:54,774 ERROR [stderr] (default task-8) at
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
2019-03-11 13:24:54,774 ERROR [stderr] (default task-8) at
io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
2019-03-11 13:24:54,774 ERROR [stderr] (default task-8) at
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
2019-03-11 13:24:54,774 ERROR [stderr] (default task-8) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2019-03-11 13:24:54,774 ERROR [stderr] (default task-8) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2019-03-11 13:24:54,774 ERROR [stderr] (default task-8) at
java.lang.Thread.run(Thread.java:748)

JAX-WS Issue using wsdl

I am trying to make a simple project using JAX-WS. I am following this example: https://docs.oracle.com/javaee/7/JEETT.pdf to be precise the head about JAX-WS. I have followed all of the steps. The difference is that I am using wildfly as a server and for IDE Eclipse which is important as I had to generate the HelloService from the command prompt. The code for the webservice:
#WebService
public class Hello {
private final String message = "Hello, ";
public Hello() {
}
#WebMethod
public String sayHelloName(String name) {
return message + name + ".";
}
#WebMethod
public String sayHello() {
return message + ".";
}
}
and the code for the servlet:
#WebServlet(name = "HelloServlet", urlPatterns = { "/HelloServlet" })
public class HelloServlet extends HttpServlet {
private static final long serialVersionUID = 1530081955969170723L;
#WebServiceRef(wsdlLocation = "http://localhost:8080/SampleRest-web/Hello?wsdl")
private HelloService service;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
out.println("<html lang=\"en\">");
out.println("<head>");
out.println("<title>Servlet HelloServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet HelloServlet at " + request.getContextPath() + "</h1>");
out.println("<p>" + sayHello("world") + "</p>");
out.println("</body>");
out.println("</html>");
}
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
try {
processRequest(request, response);
} catch (ServletException e) {
e.printStackTrace();
}
System.out.println("Test2");
}
private String sayHello(java.lang.String arg0) {
try {
Hello port = service.getHelloPort();
return port.sayHelloName(arg0);
}catch (Exception e) {
e.printStackTrace();
}
return "Ne stana";
}
}
The url code with ?wsdl works fine, it generates the wsdl code. When I call the servlet this is the error I get:
5:10:37,075 ERROR [stderr] (default task-2) javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
15:10:37,076 ERROR [stderr] (default task-2) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:361)
15:10:37,077 ERROR [stderr] (default task-2) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:350)
15:10:37,078 ERROR [stderr] (default task-2) at javax.xml.ws.Service.getPort(Service.java:99)
15:10:37,078 ERROR [stderr] (default task-2) at soap.endpoints.soap.HelloService.getHelloPort(HelloService.java:72)
15:10:37,078 ERROR [stderr] (default task-2) at webclient.HelloServlet.sayHello(HelloServlet.java:49)
15:10:37,078 ERROR [stderr] (default task-2) at webclient.HelloServlet.processRequest(HelloServlet.java:32)
15:10:37,079 ERROR [stderr] (default task-2) at webclient.HelloServlet.doGet(HelloServlet.java:40)
15:10:37,080 ERROR [stderr] (default task-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
15:10:37,080 ERROR [stderr] (default task-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
15:10:37,080 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
15:10:37,081 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
15:10:37,081 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
15:10:37,081 ERROR [stderr] (default task-2) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
15:10:37,081 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:10:37,081 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
15:10:37,081 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
15:10:37,082 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:10:37,082 ERROR [stderr] (default task-2) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
15:10:37,082 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
15:10:37,082 ERROR [stderr] (default task-2) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
15:10:37,082 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
15:10:37,083 ERROR [stderr] (default task-2) at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
15:10:37,083 ERROR [stderr] (default task-2) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
15:10:37,083 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:10:37,083 ERROR [stderr] (default task-2) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
15:10:37,083 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:10:37,083 ERROR [stderr] (default task-2) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:10:37,083 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
15:10:37,083 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
15:10:37,084 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
15:10:37,084 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
15:10:37,084 ERROR [stderr] (default task-2) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
15:10:37,084 ERROR [stderr] (default task-2) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
15:10:37,084 ERROR [stderr] (default task-2) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
15:10:37,084 ERROR [stderr] (default task-2) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
15:10:37,085 ERROR [stderr] (default task-2) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
15:10:37,085 ERROR [stderr] (default task-2) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
15:10:37,085 ERROR [stderr] (default task-2) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
15:10:37,085 ERROR [stderr] (default task-2) at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
15:10:37,085 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
15:10:37,085 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
15:10:37,086 ERROR [stderr] (default task-2) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
15:10:37,086 ERROR [stderr] (default task-2) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
15:10:37,086 ERROR [stderr] (default task-2) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
15:10:37,086 ERROR [stderr] (default task-2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
15:10:37,086 ERROR [stderr] (default task-2) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
15:10:37,087 ERROR [stderr] (default task-2) at java.lang.Thread.run(Thread.java:748)
15:10:37,087 ERROR [stderr] (default task-2) Caused by: org.apache.cxf.service.factory.ServiceConstructionException
15:10:37,087 ERROR [stderr] (default task-2) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:329)
15:10:37,087 ERROR [stderr] (default task-2) at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
15:10:37,087 ERROR [stderr] (default task-2) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:423)
15:10:37,088 ERROR [stderr] (default task-2) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:525)
15:10:37,088 ERROR [stderr] (default task-2) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261)
15:10:37,088 ERROR [stderr] (default task-2) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199)
15:10:37,088 ERROR [stderr] (default task-2) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
15:10:37,088 ERROR [stderr] (default task-2) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)
15:10:37,088 ERROR [stderr] (default task-2) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)
15:10:37,088 ERROR [stderr] (default task-2) at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
15:10:37,089 ERROR [stderr] (default task-2) at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:493)
15:10:37,089 ERROR [stderr] (default task-2) at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.createPort(ProviderImpl.java:578)
15:10:37,089 ERROR [stderr] (default task-2) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:359)
15:10:37,089 ERROR [stderr] (default task-2) ... 46 more
15:10:37,089 ERROR [stderr] (default task-2) Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions
15:10:37,089 ERROR [stderr] (default task-2) Two classes have the same XML type name "{http://soap/}sayHello". Use #XmlType.name and #XmlType.namespace to assign different names to them.
15:10:37,094 ERROR [stderr] (default task-2) this problem is related to the following location:
15:10:37,094 ERROR [stderr] (default task-2) at soap.endpoints.soap.jaxws_asm.SayHello
15:10:37,094 ERROR [stderr] (default task-2) this problem is related to the following location:
15:10:37,094 ERROR [stderr] (default task-2) at soap.endpoints.soap.SayHello
15:10:37,094 ERROR [stderr] (default task-2) at public javax.xml.bind.JAXBElement soap.endpoints.soap.ObjectFactory.createSayHello(soap.endpoints.soap.SayHello)
15:10:37,094 ERROR [stderr] (default task-2) at soap.endpoints.soap.ObjectFactory
15:10:37,094 ERROR [stderr] (default task-2) Two classes have the same XML type name "{http://soap/}sayHelloResponse". Use #XmlType.name and #XmlType.namespace to assign different names to them.
15:10:37,094 ERROR [stderr] (default task-2) this problem is related to the following location:
15:10:37,094 ERROR [stderr] (default task-2) at soap.endpoints.soap.jaxws_asm.SayHelloResponse
15:10:37,094 ERROR [stderr] (default task-2) this problem is related to the following location:
15:10:37,094 ERROR [stderr] (default task-2) at soap.endpoints.soap.SayHelloResponse
15:10:37,094 ERROR [stderr] (default task-2) at public javax.xml.bind.JAXBElement soap.endpoints.soap.ObjectFactory.createSayHelloResponse(soap.endpoints.soap.SayHelloResponse)
15:10:37,095 ERROR [stderr] (default task-2) at soap.endpoints.soap.ObjectFactory
15:10:37,095 ERROR [stderr] (default task-2) Two classes have the same XML type name "{http://soap/}sayHelloNameResponse". Use #XmlType.name and #XmlType.namespace to assign different names to them.
15:10:37,095 ERROR [stderr] (default task-2) this problem is related to the following location:
15:10:37,095 ERROR [stderr] (default task-2) at soap.endpoints.soap.jaxws_asm.SayHelloNameResponse
15:10:37,095 ERROR [stderr] (default task-2) this problem is related to the following location:
15:10:37,095 ERROR [stderr] (default task-2) at soap.endpoints.soap.SayHelloNameResponse
15:10:37,095 ERROR [stderr] (default task-2) at public javax.xml.bind.JAXBElement soap.endpoints.soap.ObjectFactory.createSayHelloNameResponse(soap.endpoints.soap.SayHelloNameResponse)
15:10:37,095 ERROR [stderr] (default task-2) at soap.endpoints.soap.ObjectFactory
15:10:37,095 ERROR [stderr] (default task-2) Two classes have the same XML type name "{http://soap/}sayHelloName". Use #XmlType.name and #XmlType.namespace to assign different names to them.
15:10:37,095 ERROR [stderr] (default task-2) this problem is related to the following location:
15:10:37,095 ERROR [stderr] (default task-2) at soap.endpoints.soap.jaxws_asm.SayHelloName
15:10:37,095 ERROR [stderr] (default task-2) this problem is related to the following location:
15:10:37,095 ERROR [stderr] (default task-2) at soap.endpoints.soap.SayHelloName
15:10:37,095 ERROR [stderr] (default task-2) at public javax.xml.bind.JAXBElement soap.endpoints.soap.ObjectFactory.createSayHelloName(soap.endpoints.soap.SayHelloName)
15:10:37,095 ERROR [stderr] (default task-2) at soap.endpoints.soap.ObjectFactory
15:10:37,095 ERROR [stderr] (default task-2)
15:10:37,101 ERROR [stderr] (default task-2) at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:106)
15:10:37,102 ERROR [stderr] (default task-2) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:460)
15:10:37,102 ERROR [stderr] (default task-2) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:292)
15:10:37,102 ERROR [stderr] (default task-2) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:139)
15:10:37,102 ERROR [stderr] (default task-2) at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1138)
15:10:37,103 ERROR [stderr] (default task-2) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:162)
15:10:37,103 ERROR [stderr] (default task-2) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:10:37,103 ERROR [stderr] (default task-2) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
15:10:37,103 ERROR [stderr] (default task-2) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:10:37,103 ERROR [stderr] (default task-2) at java.lang.reflect.Method.invoke(Method.java:498)
15:10:37,104 ERROR [stderr] (default task-2) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
15:10:37,104 ERROR [stderr] (default task-2) at javax.xml.bind.ContextFinder.find(ContextFinder.java:392)
15:10:37,104 ERROR [stderr] (default task-2) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618)
15:10:37,104 ERROR [stderr] (default task-2) at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:348)
15:10:37,104 ERROR [stderr] (default task-2) at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:346)
15:10:37,104 ERROR [stderr] (default task-2) at java.security.AccessController.doPrivileged(Native Method)
15:10:37,104 ERROR [stderr] (default task-2) at org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:346)
15:10:37,104 ERROR [stderr] (default task-2) at org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:247)
15:10:37,104 ERROR [stderr] (default task-2) at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:472)
15:10:37,105 ERROR [stderr] (default task-2) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:327)
15:10:37,105 ERROR [stderr] (default task-2) ... 58 more
15:10:37,106 INFO [stdout] (default task-2) Test2
Again I managed to find the solution myself. The problem was on the client side. When executing the command: wsimport, a pack of classes was created and in them their
#XmlType(name = "SayHelloName", propOrder = {
"arg0"
})
was not ok. The name was with small first letter which led to the exception. As soon as I changed it, it started working. Hope this answer helps other beginners with JAX-WS

Invoking servlet from java

I'm trying to write a java class named Sender.java that invoke a servlet.
This is the code for Sender.java :
public class Sender {
public static void main(String args[]){
try{
URL gwtServlet = new URL("http://localhost/FileReceiver/Receiver");
HttpURLConnection servletConnection = (HttpURLConnection) gwtServlet.openConnection();
servletConnection.setRequestMethod("POST");
servletConnection.setDoOutput(true);
servletConnection.setDoInput(true);
servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches (false);
OutputStream os = servletConnection.getOutputStream();
ObjectOutputStream out = new ObjectOutputStream(os);
out.writeInt(1);
out.flush();
out.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
and here the code for the servlet Receiver.java :
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
InputStream is = request.getInputStream();
//until here is ok
ObjectInputStream ois = new ObjectInputStream(is);
int p = ois.readInt();
writer.println("the number p is : " + p);
ois.close();
} catch (Exception exc) {
exc.printStackTrace();
}
}
When I try to run on server (WildFly 8.x) the servlet, I have this error:
14:52:20,193 ERROR [stderr] (default task-7) java.io.EOFException
14:52:20,193 ERROR [stderr] (default task-7) at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
14:52:20,193 ERROR [stderr] (default task-7) at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
14:52:20,193 ERROR [stderr] (default task-7) at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
14:52:20,193 ERROR [stderr] (default task-7) at java.io.ObjectInputStream.<init>(Unknown Source)
14:52:20,193 ERROR [stderr] (default task-7) at fileServlet.servlet.Receiver.doPost(Receiver.java:67)
14:52:20,193 ERROR [stderr] (default task-7) at fileServlet.servlet.Receiver.doGet(Receiver.java:46)
14:52:20,193 ERROR [stderr] (default task-7) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
14:52:20,193 ERROR [stderr] (default task-7) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
14:52:20,193 ERROR [stderr] (default task-7) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
14:52:20,193 ERROR [stderr] (default task-7) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
14:52:20,193 ERROR [stderr] (default task-7) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
14:52:20,194 ERROR [stderr] (default task-7) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)
14:52:20,194 ERROR [stderr] (default task-7) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727)
14:52:20,194 ERROR [stderr] (default task-7) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
14:52:20,194 ERROR [stderr] (default task-7) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
14:52:20,194 ERROR [stderr] (default task-7) at java.lang.Thread.run(Unknown Source)
I got that the problem is about InputStream is = request.getInputStream(); because I can see this from the debugger (is is null) but I don't know why this happens.
Can someone help me? thank you in advance.
If you want to do an HTTP POST from a Java client to a Servlet, the following requirement must be met:
The Content-Type header must be application/x-www-form-urlencoded. This is usually the default. If you want to send file data or any relevant data stream set your Content-Type to multipart/form-data. This requires the information sent to conform to RFC2388.
Values sent from the connection OutputStream to the Servlet must be an encoded (application/x-www-form-urlencoded) key/value pair (separated by a &).
The Content-Length header must be the length of the encoded value mentioned in 2 or the length of all data that you're willing to send to the server/servlet.
On the Servlet side, you can use request.getParameter() method (passing the parameter key) to obtain its value. For multipart/form-data, you can then use request.getInputStream().
I hope this helps. A brilliant example, written by BalusC on StackOverflow, on how to fire HTTP POST in Java can be found here.

Email sending in a Java Webapplication

I'm writing a webapp in Java. In this webapp I will send emails to the users. When I execute the application I get an error message. I use the same source code in another Java program. In that program I get no errors.
Source code:
public class MailUtil {
public static Session getGMailSession(String user, String pass){
final Properties props = new Properties();
//Eigenschaften zum Sende einer Mail mit GMail
props.setProperty("mail.smtp.host", "smtp.gmail.com");
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.smtp.port", "465");
props.setProperty("mail.smtp.socketFactory.port", "465");
props.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.setProperty("mail.smtp.socketFactory.fallback", "false");
return Session.getInstance(props, new javax.mail.Authenticator(){
#Override protected PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication (props.getProperty("mail.pop3.user"),props.getProperty("mail.pop3.password"));
}//endof Methode getPasswordAuthentication
});//endOf getInstance
}//endOf Methode getGMailSession
//Die Methode postMail versendet eine Mail
public static void postMail(String recipient, String subject, String message){
Session session = MailUtil.getGMailSession("user", "password");
try{
Message msg = new MimeMessage(session);
msg.setSubject(subject);
msg.setContent(message, "text/plain");
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(recipient));
Transport.send(msg);
}
catch(MessagingException e){
System.out.println("Error in this Method");
System.out.println("Cause: " +e.getMessage());
e.printStackTrace();
}
}
}
And here is the error message:
10:27:50,014 INFO [stdout] (default task-16) **Error in this Method**
10:27:50,014 INFO [stdout] (default task-16) Cause: failed to connect, no user name specified?
10:27:50,015 ERROR [stderr] (default task-16) javax.mail.AuthenticationFailedException: failed to connect, no user name specified?
10:27:50,016 ERROR [stderr] (default task-16) at javax.mail.Service.connect(Service.java:376)
10:27:50,016 ERROR [stderr] (default task-16) at javax.mail.Service.connect(Service.java:226)
10:27:50,016 ERROR [stderr] (default task-16) at javax.mail.Service.connect(Service.java:175)
10:27:50,017 ERROR [stderr] (default task-16) at javax.mail.Transport.send0(Transport.java:253)
10:27:50,017 ERROR [stderr] (default task-16) at javax.mail.Transport.send(Transport.java:124)
10:27:50,017 ERROR [stderr] (default task-16) at de.hskl.lernanalyse.utilities.MailUtil.postMail(MailUtil.java:50)
10:27:50,018 ERROR [stderr] (default task-16) at de.hskl.lernanalyse.controller.TokenGenController.doGeneriereLink(TokenGenController.java:77)
10:27:50,018 ERROR [stderr] (default task-16) at de.hskl.lernanalyse.controller.TokenGenController.doSendeEmail(TokenGenController.java:108)
10:27:50,018 ERROR [stderr] (default task-16) at de.hskl.lernanalyse.controller.TokenGenController$Proxy$_$$_WeldClientProxy.doSendeEmail(Unknown Source)
10:27:50,019 ERROR [stderr] (default task-16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:27:50,025 ERROR [stderr] (default task-16) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
10:27:50,025 ERROR [stderr] (default task-16) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:27:50,026 ERROR [stderr] (default task-16) at java.lang.reflect.Method.invoke(Method.java:606)
10:27:50,026 ERROR [stderr] (default task-16) at javax.el.ELUtil.invokeMethod(ELUtil.java:308)
10:27:50,026 ERROR [stderr] (default task-16) at javax.el.BeanELResolver.invoke(BeanELResolver.java:537)
10:27:50,027 ERROR [stderr] (default task-16) at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
10:27:50,027 ERROR [stderr] (default task-16) at com.sun.el.parser.AstValue.invoke(AstValue.java:269)
10:27:50,027 ERROR [stderr] (default task-16) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
10:27:50,027 ERROR [stderr] (default task-16) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
10:27:50,028 ERROR [stderr] (default task-16) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
10:27:50,029 ERROR [stderr] (default task-16) at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
10:27:50,029 ERROR [stderr] (default task-16) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
10:27:50,030 ERROR [stderr] (default task-16) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
10:27:50,031 ERROR [stderr] (default task-16) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
10:27:50,031 ERROR [stderr] (default task-16) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
10:27:50,032 ERROR [stderr] (default task-16) at javax.faces.component.UICommand.broadcast(UICommand.java:315)
10:27:50,032 ERROR [stderr] (default task-16) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
10:27:50,033 ERROR [stderr] (default task-16) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
10:27:50,033 ERROR [stderr] (default task-16) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
10:27:50,034 ERROR [stderr] (default task-16) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
10:27:50,035 ERROR [stderr] (default task-16) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
10:27:50,035 ERROR [stderr] (default task-16) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
10:27:50,035 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
10:27:50,036 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
10:27:50,037 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
10:27:50,037 ERROR [stderr] (default task-16) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
10:27:50,038 ERROR [stderr] (default task-16) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
10:27:50,039 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)
10:27:50,039 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
10:27:50,040 ERROR [stderr] (default task-16) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
10:27:50,041 ERROR [stderr] (default task-16) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
10:27:50,041 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)
10:27:50,042 ERROR [stderr] (default task-16) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
10:27:50,042 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
10:27:50,043 ERROR [stderr] (default task-16) at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
10:27:50,043 ERROR [stderr] (default task-16) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
10:27:50,045 ERROR [stderr] (default task-16) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
10:27:50,045 ERROR [stderr] (default task-16) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
10:27:50,053 ERROR [stderr] (default task-16) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
10:27:50,053 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)
10:27:50,054 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
10:27:50,054 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
10:27:50,055 ERROR [stderr] (default task-16) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
10:27:50,055 ERROR [stderr] (default task-16) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)
10:27:50,056 ERROR [stderr] (default task-16) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727)
10:27:50,056 ERROR [stderr] (default task-16) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
10:27:50,056 ERROR [stderr] (default task-16) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
10:27:50,057 ERROR [stderr] (default task-16) at java.lang.Thread.run(Thread.java:745)
You have missed the ,
msg.setFrom(username);
method ,which should be configured to send the email from your account.
As docs says.
Set the "From" attribute in this Message. The value of this attribute
is obtained from the property "mail.user". If this property is absent,
the system property "user.name" is used.
And also read this thread JavaMail API, Gmail-Auth and setFrom
First, fix all of these common mistakes.
Second, read this JavaMail FAQ entry on Gmail.
If you still can't get it to work and are getting the same error, tell us what debugging you've done to prove that you're specifying a user name when connecting. You might want to look at these debugging tips.

Categories