WFLYCTL0180: Services with missing/unavailable dependencies in Wildfly 26 with EJB SecurityDomain annotation - wildfly

We've got an application with several web services annotated with #SecurityDomain("our-ws") (I've also tried setting this in jboss-web.xml). For example:
#Stateless
#Interceptors(OurTransactionInterceptor.class)
#WebService(targetNamespace = "...", portName = "AddStuff", serviceName = "AddStuffService")
#SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
#WebContext(authMethod = "BASIC", contextRoot = "/service", urlPattern = "/AddStuffService")
#SecurityDomain("our-ws")
public class AddStuffService { ... }
We are upgrading to Wildfly 26, and attempting to use elytron following the example from
WildFly Elytron Security, section 4.1.3. However, on startup, I'm getting an error like:
13 Jan 2023 11:26:01,763 ERROR [management-operation Controller Boot Thread] WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "service.war")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.security.security-domain.our-ws"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"service.war\".component.AddStuffService.CREATE is missing [jboss.security.security-domain.our-ws]"]
}
In standalone.xml, under <subsystem xmlns="urn:wildfly:elytron:15.1"...> We've got a datasource, which I'll call 'ourDS' (not shown) used by a jdbc-realm, jdbc:
<jdbc-realm name="jdbc">
<principal-query sql="SELECT password FROM CFG_WS_USERS_T WHERE username=?" data-source="evercoreDS">
<clear-password-mapper password-index="1"/>
</principal-query>
<principal-query sql="SELECT roles from CFG_WS_ROLES_T r join CFG_WS_USERS_T u on u.WS_USERS_PK=r.WS_USERS_FK where u.username=?" data-source="ourDS">
<attribute-mapping>
<attribute to="roles" index="1"/>
</attribute-mapping>
</principal-query>
</jdbc-realm>
And a security-domain for those web services:
<security-domain name="our-ws" default-realm="jdbc" permission-mapper="default-permission-mapper">
<realm name="jdbc" role-decoder="groups-to-roles"/>
</security-domain>
So I don't get why jboss.security.security-domain.our-ws is not installed (unless, maybe, it is looking for it in the legacy security configuration.).
How, do I get the SecurityDomain annotation (or the security-domain tag in jboss-web.xml) to refer to the elytron configuration, or why would my security-domain under elytron not be installed?
EDIT: In response to #ehsavoie's comment, I'll note that, per section 4.1.3 of the doc, we also have an http-authentication-factory and application-security-domain:
<http-authentication-factory name="our-ws-http-auth" security-domain="our-ws" http-server-mechanism-factory="global">
<mechanism-configuration>
<mechanism mechanism-name="BASIC">
<mechanism-realm realm-name="our-ws"/>
</mechanism>
</mechanism-configuration>
</http-authentication-factory>
<application-security-domains>
<application-security-domain name="defaultASD" security-domain="ApplicationDomain"/>
<application-security-domain name="our-ws-appsecurity-domain" http-authentication-factory="our-ws-http-auth"/>
</application-security-domains>
(I'm a bit confused by the mechanism-realm realm-name="our-ws", since our-ws is not a security-realm, but a security-domain, but it follows the documentation - again section 4.1.3-- and I also tried using the jdbc security-realm there, with the the same error.)

Related

NameNotFoundException: connecting to remote queue via logstash

I have a deployed queue on JBoss EAP 7.1 (defined in standalone.xml) that is managed by ActiveMQ Artemis (name of the module xmlns="urn:jboss:domain:messaging-activemq:2.0") and at the same time I want to connect to that queue with the JMS plugin in logstash (with JNDI) for consuming the messages that are sent by the deployed app on my JBoss server, but when I try I get a NameNotFoundException for the connection factory (the property jndi_name in the logstash conf file).
I tried to find the default connection factories JNDI entries but even then it didn't work.
So i want to know if the connection factories are created by the message broker or exist by default for the client? Because if I'm not mistaken, the connection factory is the only way to connect to the broker and the queue and correct if I'm wrong please but they have to exist by default for the client.
I hope you can help me guys here is my logstash conf file:
input {
jms {
# Logstash Configuration Settings.
include_header => false
include_properties => false
include_body => true
use_jms_timestamp => false
destination => "AuditTrailMDB"
pub_sub => false
# JNDI Settings
jndi_name => 'queueConnectionFactory'
jndi_context => {
'java.naming.factory.initial' => 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory'
'java.naming.security.principal' => 'admin'
'java.naming.provider.url' => 'tcp://localhost:5445?type=QUEUE_CF'
'java.naming.security.credentials' => 'admin'
}
# Jar files to be imported
require_jars=> ['/home/Alternant/logstash/dependencies/jboss-client.jar',
'/home/Alternant/logstash/dependencies/artemis-ra.jar',
'/home/Alternant/logstash/dependencies/ironjacamar-core-impl.jar',
'/home/Alternant/logstash/dependencies/ironjacamar-core-api.jar',
'/home/Alternant/logstash/dependencies/ironjacamar-common-api.jar']
}
}output{
stdout{}
}
and here is my queue definition in the standalone.xml:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
<server name="default">
<security-setting name="#">
<role consume="true" create-non-durable-queue="true" delete-non-durable-queue="true" name="guest" send="true"/>
</security-setting>
<address-setting dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" message-counter-history-day-limit="10" name="#" page-size-bytes="2097152"/>
<http-connector endpoint="http-acceptor" name="http-connector" socket-binding="http"/>
<http-connector endpoint="http-acceptor-throughput" name="http-connector-throughput" socket-binding="http">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<remote-connector name="netty" socket-binding="remote-messaging"/>
<http-acceptor http-listener="default" name="http-acceptor"/>
<http-acceptor http-listener="default" name="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<remote-acceptor name="netty" socket-binding="messaging"/>
<jms-queue entries="java:/jms/queue/ExpiryQueue" name="ExpiryQueue"/>
<jms-queue entries="java:/jms/queue/DLQ" name="DLQ"/>
<jms-queue entries="queue/clientPending" name="clientPending"/>
<jms-queue name="AuditTrailMDB" entries="queue/AuditTrailMDB"/>
<connection-factory connectors="in-vm" entries="java:/ConnectionFactory" name="InVmConnectionFactory"/>
<pooled-connection-factory connectors="netty" entries="java:jboss/exported/jms/RemoteConnectionFactory" name="RemoteConnectionFactory" user="admin" password="admin"/>
<pooled-connection-factory connectors="in-vm" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" name="activemq-ra" transaction="xa"/>
<connection-factory connectors="in-vm" entries="/ApplicationsQueueConnectionFactory" name="ApplicationsQueueConnectionFactory"/>
</server>
</subsystem>
...
<socket-binding name="messaging" port="5445"/>
...
log:
[WARN ][logstash.inputs.jms ][main] JMS Consumer Died {:exception=>"Java::JavaxNaming::NameNotFoundException", :exception_message=>"queueConnectionFactory", :backtrace=>["org.apache.activemq.artemis.jndi.ReadOnlyContext.lookup(org/apache/activemq/artemis/jndi/ReadOnlyContext.java:236)", "javax.naming.InitialContext.lookup(javax/naming/InitialContext.java:417)", "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)", "org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:455)", "org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:316)", "home.Alternant.logstash.vendor.bundle.jruby.$2_dot_5_dot_0.gems.jruby_minus_jms_minus_1_dot_3_dot_0_minus_java.lib.jms.connection.initialize
There's a handful of things wrong with your configuration both for JBoss EAP and for Logstash.
Let's start with JBoss EAP...
First, you changed the default configuration of RemoteConnectionFactory to this:
<pooled-connection-factory connectors="netty" entries="java:jboss/exported/jms/RemoteConnectionFactory" name="RemoteConnectionFactory" user="admin" password="admin"/>
This is incorrect. A remote client cannot use a pooled-connection-factory, only a client in the same JVM as the application server can (e.g. an MDB which needs to send a message). You should use the default configuration instead:
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
Second, your AuditTrailMDB queue will not be available to remote clients. Here's its configuration:
<jms-queue name="AuditTrailMDB" entries="queue/AuditTrailMDB"/>
It needs a new JNDI entry in the java:jboss/exported/ namespace in order to be available to remote clients (e.g. like RemoteConnectionFactory has). Therefore you should use this:
<jms-queue name="AuditTrailMDB" entries="queue/AuditTrailMDB java:jboss/exported/AuditTrailMDB"/>
Now for Logstash...
First, you're using the wrong JNDI properties. The properties you're using are for the ActiveMQ Artemis JNDI implementation. Here's your current configuration:
jndi_context => {
'java.naming.factory.initial' => 'org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory'
'java.naming.security.principal' => 'admin'
'java.naming.provider.url' => 'tcp://localhost:5445?type=QUEUE_CF'
'java.naming.security.credentials' => 'admin'
}
This is incorrect. When ActiveMQ Artemis is embedded into JBoss EAP then EAP itself handles all the JNDI lookups. Therefore you should be using this configuration instead:
jndi_context => {
'java.naming.factory.initial' => 'org.wildfly.naming.client.WildFlyInitialContextFactory'
'java.naming.security.principal' => 'admin'
'java.naming.provider.url' => 'http-remoting://127.0.0.1:8080'
'java.naming.security.credentials' => 'admin'
}
This assumes, of course, that you've added the proper admin user to EAP.
Second, your connection factory JNDI name is incorrect. You're currently using this:
jndi_name => 'queueConnectionFactory'
You should be using this instead:
jndi_name => 'jms/RemoteConnectionFactory'
Third, the jars you're using are incorrect. Here's your current configuration:
require_jars=> ['/home/Alternant/logstash/dependencies/jboss-client.jar',
'/home/Alternant/logstash/dependencies/artemis-ra.jar',
'/home/Alternant/logstash/dependencies/ironjacamar-core-impl.jar',
'/home/Alternant/logstash/dependencies/ironjacamar-core-api.jar',
'/home/Alternant/logstash/dependencies/ironjacamar-common-api.jar']
You don't need most of these at all. You can simplify your configuration by using the wildfly-client-all "uber" jar which is available here. Then your configuration would look like this:
require_jars=> ['/home/Alternant/logstash/dependencies/wildfly-client-all-7.1.0.GA-redhat-11.jar']

How to configure outbound-socket-binding for SMTP mail in wildfly swarm for using yaml?

I am porting an application from Wildfly 10.0.1.0 to Wildly Swarm 2017.7.0.
Everything went rather smoothly except for the SMTP e-mail configuration using YAML:
I tried some alternatives, but here is the latest one based on what I think the yaml would be from standalone.xml mapping - project-defaults.yml
swarm:
socket-binding-groups:
mail-socket:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
mail:
mail-sessions:
smtpSession:
jndi-name: java:/smtpSession
smtp-server:
username: username_here
password: password_here
tls: true
outbound-socket-binding-ref: mail-smtp
However I still get error:
2017-08-05 11:17:36,100 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "mail"),
("mail-session" => "smtpSession")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.outbound-socket-binding.mail-smtp"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.mail-session.smtpSession is missing [jboss.outbound-socket-binding.mail-smtp]"]
}
2017-08-05 11:17:36,155 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.outbound-socket-binding.mail-smtp (missing) dependents: [service jboss.mail-session.smtpSession]
------------------ Edited August 7th, 2017 -------------------
As advised by Ladicek I tried this:
swarm:
socket-binding-groups:
standard-sockets:
mail-socket:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
and
swarm:
socket-binding-groups:
standard-sockets:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
and
swarm:
socket-binding-groups:
standard-socket:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
However neither is working, still have the same error.
Could anyone please help on this?
---------------------- SOLVED ----------------------------
Need to upgrade to 2017.8.1 and use the below configuration
network:
socket-binding-groups:
standard-sockets:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
Thank you.
From the top of my head, I believe there's one level of the YAML structure you're missing: you need to select the socket binding group to which you add the socket binding. That's an artifact of WildFly's managed domain, which is a concept that doesn't apply to Swarm, yet you sometimes run into it. There's only one socket binding group in standalone WildFly and hence in Swarm: standard-sockets.
So the YAML will look like:
swarm:
socket-binding-groups:
standard-sockets:
mail-socket:
...
Also for any kind of questions about the Swarm YAML structure, consult https://reference.wildfly-swarm.io
Finally solved:
Need to upgrade to 2017.8.1 and use the below configuration
network:
socket-binding-groups:
standard-sockets:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
Thank you.
This worked for me.
yml File:
swarm:
mail:
mail-sessions:
mail-socket:
jndi-name: java:/mail/NGSoftMail
smtp-server:
username: sigafco#xxxmail.com.co
password: *****
outbound-socket-binding-ref: mail-smtp
debug: true
from: sigafco#xxxmail.com.co
network:
socket-binding-groups:
standard-sockets:
outbound-socket-bindings:
mail-smtp:
remote-host: xxxmail.com.co
remote-port: 25
java File:
#ApplicationScoped
#Path("mailsender")
public class MailSender {
#Resource(mappedName = "java:/mail/NGSoftMail")
private Session session;
#GET
#Path("mail")
public String sendGet() throws Exception {
Message message = new MimeMessage(session);
message.setFrom();
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("david.vasquez#xxx.com.co", false));
message.setSubject("asunto!!!");
message.setSentDate(new Date());
message.setContent("contenido!!!", "text/html; charset=UTF-8");
Transport.send(message);
return String.format("{\"your_mail\": \"%s\"}", "OK");
}
}
pom file:
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>mail</artifactId>
</dependency>

Archiva deployment on wildfly 10

I have the following problem when i try to deploy archiva 2.2.1 on wildfly 10.
Can someone help me to resolve it ?
Unexpected HTTP response: 500
Request
{
"operation" => "deploy",
"address" => [("deployment" => "archiva.war")]
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.archiva.archiva.env.mail.Session is missing [jboss.naming.context.java.jboss.resources.mail.Session]"]},
"rolled-back" => true
}
You need to specify the JNDI name in your WEB-INF/web.xml file in the archiva JAR.
<resource-ref>
<res-ref-name>mail/Session</res-ref-name>
<res-type>javax.mail.Session</res-type>
<jndi-name>java:jboss/mail/Default</jndi-name>
</resource-ref>
You can find the JNDI name by referring to the standalone/configurations/standalone-full.xml.
<subsystem xmlns="urn:jboss:domain:mail:2.0">
<mail-session name="default" jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
</subsystem>
Note the JNDI name of the mail session is java:jboss/mail/Default.

jBPM6.3+Hibernate4+Tomcat7+JPA2.0Exception: Unable to build EntityManagerFactory

I was trying to make this example work for me. Since my jbpm version is 6.3.0.Final, so this solution absolutely won't solve my problem.
My scenario is, firstly, I created a JPA & Dynamic Web Project by using Eclipse Mars1, and copied all the example files into my new project, then modified TaskProcessServlet.java, as shown below, because of the obsoleteness and deprecation of the Runtimepart in original servlet code. When I built my project and ran on independent Tomcat 7.0.64 other than server inside of Eclipse, and jsp showed up without any problem, but when I clicked create Processwhich will fire the TaskProcessServlet, I got an error message:
Error:[PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory
Would my postgresql-9.4.1207.jar(for Tomcat8) be a problem? I don't think so because I kept getting same error in Tomcat 8, so I downgrade my Tomcat from 8.0.30 to Tomcat 7.0.64.
I'm able to run jbpm-console from JBOSS both on my Tomcat 8 and 7. Does this jbpm-console interfere my project?
How to tackle this problem?
Any idea would be appreciated, thank you very much.
Software Environment:
Ubuntu 64-bit 14.04
Eclipse Mars1
jBPM 6.3.0.Final
PostgreSQL 9.3(postgresql-9.4.1207.jar)
Hibernate 4.2.21.Final
JPA 2.0
Tomcat 7.0.64
NO Spring
NO Maven
TaskProcessServlet.java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String action = request.getParameter("action");
if (action.equals("CreateProcess")) {
/*
UserTransaction ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
ut.begin();
*
* Get the local task service
*
KieSession ksession = JBPMUtil.getSingletonSession();
TaskService taskService = JBPMUtil.getTaskService();
ksession.startProcess("com.autopal.bpmn.sampleHTformvariables",params);
System.out.println(" after start");
//ksession.fireAllRules();
ut.commit();
*/
// create the entity manager factory
EntityManagerFactory emf = EntityManagerFactoryManager.get().getOrCreate("org.jbpm.persistence.jpa");
TransactionManager tm = TransactionManagerServices.getTransactionManager();
// setup the runtime environment
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get()
.newDefaultBuilder()
.addAsset(ResourceFactory.newClassPathResource("taskexample/SampleHumanTaskFormVariables.bpmn"), ResourceType.BPMN2)
.addEnvironmentEntry(EnvironmentName.TRANSACTION_MANAGER, tm)
.get();
// get the kie session
RuntimeManager manager = RuntimeManagerFactory.Factory.get().newPerRequestRuntimeManager(environment);
RuntimeEngine runtime = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
KieSession ksession = runtime.getKieSession();
// start the transaction
UserTransaction ut = InitialContext.doLookup("java:comp/UserTransaction");
ut.begin();
Map<String, Object> params = new HashMap<String, Object>();
params.put("priority", "High");
params.put("modelNumber", "123");
params.put("quantity", "66");
// perform multiple commands inside one transaction
ksession.startProcess("com.autopal.bpmn.sampleHTformvariables",params);
// commit the transaction
ut.commit();
request.setAttribute("message", "Process Created!");
RequestDispatcher rD = request.getRequestDispatcher("adminuser.jsp");
rD.forward(request, response);
}
...
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:comp/env/jdbc/jbpm-ds</jta-data-source>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
<mapping-file>META-INF/Taskorm.xml</mapping-file>
<mapping-file>META-INF/Executor-orm.xml</mapping-file>
<mapping-file>META-INF/Servicesorm.xml</mapping-file>
<mapping-file>META-INF/TaskAuditorm.xml</mapping-file>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<class>org.jbpm.process.audit.ProcessInstanceLog</class>
<class>org.jbpm.process.audit.NodeInstanceLog</class>
<class>org.jbpm.process.audit.VariableInstanceLog</class>
<class>org.jbpm.persistence.correlation.CorrelationKeyInfo</class>
<class>org.jbpm.persistence.correlation.CorrelationPropertyInfo</class>
<!-- manager -->
<class>org.jbpm.runtime.manager.impl.jpa.ContextMappingInfo</class>
<class>org.jbpm.services.task.impl.model.AttachmentImpl</class>
<class>org.jbpm.services.task.impl.model.ContentImpl</class>
<class>org.jbpm.services.task.impl.model.BooleanExpressionImpl</class>
<class>org.jbpm.services.task.impl.model.CommentImpl</class>
<class>org.jbpm.services.task.impl.model.DeadlineImpl</class>
<class>org.jbpm.services.task.impl.model.DelegationImpl</class>
<class>org.jbpm.services.task.impl.model.EscalationImpl</class>
<class>org.jbpm.services.task.impl.model.GroupImpl</class>
<class>org.jbpm.services.task.impl.model.I18NTextImpl</class>
<class>org.jbpm.services.task.impl.model.NotificationImpl</class>
<class>org.jbpm.services.task.impl.model.EmailNotificationImpl</class>
<class>org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl</class>
<class>org.jbpm.services.task.impl.model.PeopleAssignmentsImpl</class>
<class>org.jbpm.services.task.impl.model.ReassignmentImpl</class>
<class>org.jbpm.services.task.impl.model.TaskImpl</class>
<class>org.jbpm.services.task.impl.model.TaskDataImpl</class>
<class>org.jbpm.services.task.impl.model.UserImpl</class>
<!--BAM for task service -->
<class>org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl</class>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL9Dialect"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.jndi.class" value="bitronix.tm.jndi.BitronixInitialContextFactory"/>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.BitronixJtaPlatform"/>
</properties>
</persistence-unit>
Catalina.out
INFO: HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.password=****, c3p0.numHelperThreads=10, c3p0.maxIdleTime=60, c3p0.testConnectionOnCheckout=true, c3p0.maxStatements=100, hibernate.show_sql=true, hibernate.default_catalog=mybox, hibernate.jdbc.batch_size=50, hibernate.bytecode.use_reflection_optimizer=false, hibernate.jdbc.fetch_size=100, c3p0.maxPoolSize=30, c3p0.initialPoolSize=3, hibernate.hbm2ddl.auto=create, hibernate.default_schema=public, hibernate.connection.release_mode=after_transaction, hibernate.connection.username=postgres, c3p0.idleConnectionTestPeriod=900, hibernate.connection.driver_class=org.postgresql.Driver, c3p0.minPoolSize=2, c3p0.preferredTestQuery=select now(), c3p0.acquireIncrement=3, hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect, hibernate.connection.url=jdbc:postgresql://192.168.1.80:5432/mybox}
Feb 05, 2016 3:58:09 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Feb 05, 2016 3:58:10 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: META-INF/JBPMorm.xml
Feb 05, 2016 3:58:10 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: META-INF/Taskorm.xml
Feb 05, 2016 3:58:10 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: META-INF/Executor-orm.xml
Feb 05, 2016 3:58:10 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: META-INF/Servicesorm.xml
Feb 05, 2016 3:58:10 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: META-INF/TaskAuditorm.xml
Thanks Anton Giertli, Thank you for your attention.
I've solved this problem after modifying my server.xml and adding a hibernate.cfg.xml for JPA by referring to here.
But I still had consequential issues that I need to figure out.
Thank you any way.

How to connect JBoss 7.1.1 remoting -jmx via java code?

I have a JBoss 7.1.1 server, for which I want to write jmx client. As far I understood, jboss 7.1.1 is not using typical rmi based jmx and they have given a layer of remoting-jmx over native management. I am using following code:
JMXServiceURL address = new JMXServiceURL("service:jmx:remoting-jmx://localhost:9999");
Map env = JMXConnectorConfig.getEnvironment(paramtbl);
JMXConnector connector = JMXConnectorFactory.connect(address, env);
But it is giving following exception:
java.net.MalformedURLException: Unsupported protocol: remoting-jmx
I googled it and the following thread seems relevant:
https://community.jboss.org/thread/204653?tstart=0
It asks to add jboss's libraries to my classpath. I tried that also but still getting same exception.
I got the same exception when trying to get a JmxServiceUrl.
Make sure that in your standalone.xml you have the following:
<subsystem xmlns="urn:jboss:domain:jmx:1.1">
<show-model value="true"/>
<remoting-connector use-management-endpoint="true" />
</subsystem>
And you should include in project classpath the jar named: jboss-client.jar, it can be found in JBOSS_DIRECTORY/bin/client. In fact, the JMX client must include that jar in its classpath.
This tip fixed the problem for me..Hope it will be helpful for you
Tried to do the same from Arquillian test on JBoss AS7 and finally had to use:
import org.jboss.remotingjmx.RemotingConnectorProvider;
RemotingConnectorProvider s = new RemotingConnectorProvider();
JMXConnector connector = s.newJMXConnector(url, credentials);
connector.connect();
Could not have "module name="org.jboss.remoting-jmx" services="import"" working
Also works with
environment.put("jmx.remote.protocol.provider.pkgs", "org.jboss.remotingjmx");
JMXConnector connector = JMXConnectorFactory.connect(url, environment);
connector.connect();
I used this code to connect to JBoss in a remote server
ModelControllerClient client = null;
try {
client = createClient(InetAddress.getByName("172.16.73.12"), 9999,
"admin", "pass", "ManagementRealm");
}
catch (UnknownHostException e) {
e.printStackTrace();
}
Where createClient is a method I wrote -
private ModelControllerClient createClient(final InetAddress host,
final int port, final String username, final String password,
final String securityRealmName) {
final CallbackHandler callbackHandler = new CallbackHandler() {
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (Callback current : callbacks) {
if (current instanceof NameCallback) {
NameCallback ncb = (NameCallback) current;
ncb.setName(username);
} else if (current instanceof PasswordCallback) {
PasswordCallback pcb = (PasswordCallback) current;
pcb.setPassword(password.toCharArray());
} else if (current instanceof RealmCallback) {
RealmCallback rcb = (RealmCallback) current;
rcb.setText(rcb.getDefaultText());
} else {
throw new UnsupportedCallbackException(current);
}
}
}
};
return ModelControllerClient.Factory
.create(host, port, callbackHandler);
}
For more information on how to read the data obtained from Server or for the complete project using Java/Google visualizer API (to show the statistics in Graph after every 10 secs) , Please refer to this tutorial -
http://javacodingtutorial.blogspot.com/2014/05/reading-jboss-memory-usage-using-java.html
Add the following to your jboss-deployment-structure
<dependencies>
<module name="org.jboss.remoting3.remoting-jmx" services="import"/>
</dependencies>
Activate JMX remoting subsystem by adding following entry in standalone.xml
<subsystem xmlns="urn:jboss:domain:ee:1.1">
<!-- Activate JMX remoting -->
<global-modules>
<module name="org.jboss.remoting-jmx" slot="main"/>
</global-modules>
...
</subsystem>
It seems like "jboss-client.jar" is not available at run-time for JMX connection, So make sure that you have added "jboss-client.jar" in the class path.
And also you are using deprecated protocol "remoting-jmx" instead of "remote".
i.e, "service:jmx:remote://localhost:9999"
Hope it helps.