Logging for IBM MQ JCA Resource Adapter - jboss

In versions 6 and 7 of IBM MQ, I could configure logging for the IBM MQ JCA resource adapter in JBoss as follows:
<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
<resource-adapters>
<resource-adapter id="wmq.jmsra.rar" statistics-enabled="true">
<archive>
wmq.jmsra.rar
</archive>
<config-property name="logWriterEnabled">
true
</config-property>
<config-property name="traceEnabled">
true
</config-property>
<config-property name="traceLevel">
6
</config-property>
This configuration is described in the IBM MQ documentation. In versions 8 and 9 of IBM MQ, the documentation states that the same configuration still applies. I have not been able to get it to work.
Furthermore, I can set system properties in JBoss:
<property name="com.ibm.msg.client.commonservices.trace.status" value="ON"/>
<property name="com.ibm.msg.client.commonservices.trace.level" value="10"/>
<property name="com.ibm.msg.client.commonservices.trace.append" value="true"/>
<property name="com.ibm.msg.client.commonservices.trace.startup" value="true"/>
<property name="com.ibm.msg.client.commonservices.trace.maxBytes" value="-1"/>
<property name="com.ibm.msg.client.commonservices.trace.limit" value="2097152"/>
<property name="com.ibm.msg.client.commonservices.trace.count" value="1"/>
<property name="com.ibm.msg.client.commonservices.trace.standalone" value="true"/>
<property name="com.ibm.msg.client.commonservices.trace.errorStream" value="${jboss.server.log.dir}/wmq-trace-error.log"/>
<property name="com.ibm.msg.client.commonservices.trace.outputName" value="${jboss.server.log.dir}/wmq-trace.log"/>
<property name="com.ibm.msg.client.commonservices.log.outputName" value="${jboss.server.log.dir}/wmq.log"/>
<property name="com.ibm.msg.client.commonservices.log.status" value="ON"/>
<property name="com.ibm.msg.client.commonservices.log.maxBytes" value="-1"/>
<property name="com.ibm.msg.client.commonservices.log.limit" value="2097152"/>
<property name="com.ibm.msg.client.commonservices.log.count" value="1"/>
<property name="com.ibm.msg.client.commonservices.log.append" value="true"/>
<property name="com.ibm.msg.client.commonservices.ffst.suppress" value="-1"/>
and I can get logging from the IBM MQ JCA. However, logging at traceLevel 6 does not produce any output. Only traceLevel 8 and 10 (very verbose) produce logging.

Related

How to add custom JNDI resources into wildfly-10 similar like <custom-resource> of glassfish server?

This is the code which is use to add custom resources in glassfish server but my requirement is to achieve this in wildfly-10 server but i don't know how to do it,so please help me with this
<custom-resource
factory-class="org.glassfish.resources.custom.factory.PropertiesFactory" res-
type="java.util.Properties" jndi-name="docdokuplm.config">
<property name="codebase" value="http://localhost:9001"></property>
<property name="vaultPath" value="/var/lib/docdoku"></property>
</custom-resource>
<custom-resource
factory-class="org.glassfish.resources.custom.factory.PropertiesFactory" res-
type="java.util.Properties" jndi-name="auth.config">
<property name="basic.header.enabled" value="true"></property>
<property name="session.enabled" value="true"></property>
<property name="jwt.key" value="singh20111995"></property>
<property name="jwt.enabled" value="true"></property>
</custom-resource>
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<object-factory name="java:/docdokuplm.config" module="net.flexoptix.jbossTools" class="net.flexoptix.jbossTools.PropertiesFactory">
<environment>
<property name="vaultPath" value="/var/lib/docdoku"/>
<property name="codebase" value="http://localhost:8080"/>
</environment>
</object-factory>
you can add subsystem to add custom JNDI in wildfly.

Wso2 cant write groups in external LDAP

I am configuring Wso2 with a read write external LDAP.
I am using the SOAP Api provided by Wso2 for managing users n groups.
However when trying to add a user to an internal group everything works fine but when i try to add a user to an external LDAP group i get that the role does not exist. Which is weird cause i can see the roles in Wso2. I even can i add a user to an external group from there but after it is added its not showed as added even it is actually added in the LDAP.
This is the ldap connection configuration
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
<Property name="TenantManager">org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager</Property>
<Property name="ConnectionURL">ldaps://some-url:636</Property>
<Property name="ConnectionName">cn=admin,ou=adminGroups,dc=userstore,dc=gk</Property>
<Property name="ConnectionPassword">someAdminPass</Property>
<Property name="AnonymousBind">false</Property>
<Property name="UserSearchBase">ou=users,dc=userstore,dc=gk</Property>
<Property name="UserEntryObjectClass">inetOrgPerson</Property>
<Property name="UserNameAttribute">uid</Property>
<Property name="UserNameSearchFilter">(&(objectClass=posixAccount)(uid=?))</Property>
<Property name="UserNameListFilter">(objectClass=posixAccount)</Property>
<Property name="DisplayNameAttribute"/>
<Property name="ReadGroups">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="GroupSearchBase">ou=groups,dc=userstore,dc=gk</Property>
<Property name="GroupEntryObjectClass">posixGroup</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=posixGroup)(cn=?))</Property>
<Property name="GroupNameListFilter">(objectClass=posixGroup)</Property>
<Property name="MembershipAttribute">memberOf</Property>
<Property name="BackLinksEnabled">false</Property>
<Property name="UsernameJavaRegEx">someregex stuff</Property>
<Property name="UsernameJavaScriptRegEx">someregex stuff</Property>
<Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated</Property>
<Property name="PasswordJavaRegEx">someregex stuff</Property>
<Property name="PasswordJavaScriptRegEx">someregex stuff</Property>
<Property name="PasswordJavaRegExViolationErrorMsg">Password length should be within 5 to 30 characters</Property>
<Property name="RolenameJavaRegEx">someregex stuff</Property>
<Property name="RolenameJavaScriptRegEx">someregex stuff</Property>
<Property name="SCIMEnabled">true</Property>
<Property name="IsBulkImportSupported">false</Property>
<Property name="EmptyRolesAllowed">true</Property>
<Property name="PasswordHashMethod">PLAIN_TEXT</Property>
<Property name="MultiAttributeSeparator">,</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="kdcEnabled">false</Property>
<Property name="defaultRealmName">WSO2.ORG</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ConnectionPoolingEnabled">false</Property>
<Property name="LDAPConnectionTimeout">5000</Property>
<Property name="ReadTimeout"/>
<Property name="RetryAttempts"/>
</UserStoreManager>
I am using SoapUi to make this call having this request body
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://service.ws.um.carbon.wso2.org">
<soap:Header/>
<soap:Body>
<ser:updateRoleListOfUser>
<!--Optional:-->
<ser:userName>username</ser:userName>
<!--Zero or more repetitions:-->
<ser:deletedRoles>?</ser:deletedRoles>
<!--Zero or more repetitions:-->
<ser:newRoles>Users</ser:newRoles>
</ser:updateRoleListOfUser>
</soap:Body>
</soap:Envelope>
Seems that some configuration has gone wrong.Is there some special configuration needed to to that ?
This was a silly mistake. I am passing <ser:deletedRoles>?</ser:deletedRoles> and that is what actually throws the error saying that group does not exist.
About the part that i say
after it is added its not showed as added even it is actually added in
the LDAP
This has to do with a different setup that i use in my LDAP server. I have created an additional thread for this configuration issue.

Issue with JPA in JBoss Fuse 6.2

I am trying to implement a JPA application in JBoss Fuse 6.2. The attached files are the pom.xml, blueprint.xml and persistence.xml. They are working fine in JBoss Fuse 6.1. But we are always getting the error "No providers available" in 6.2 and the deployment is going in "waiting" stage.
I believe the problem is with the "jpa" feature. In 6.2, when I do "features:info jpa", it shows hibernate's bundle as the jpa unit ( mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final), whereas in 6.1, it was the geronimo jpa bundle (mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/1.1). I believe that is causing OpenJPA to fail since OpenJPA is compliant with JPA 2.0 but not 2.1. Please guide on how to solve this problem. I have tried not to use the jpa feature and rather use the bundles of the jpa feature from 6.1 version but it did not help either.
pom.xml
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>${fabric.version}</version>
<configuration>
<profile>org-profile</profile>
<parentProfiles>feature-cxf</parentProfiles>
<features>fabric-cxf swagger cxf-jaxrs transaction jndi jpa camel-spring spring-orm spring-jdbc
</features>
<featureRepos>
mvn:org.apache.cxf.karaf/apache-cxf/${version:cxf}/xml/features
mvn:org.apache.camel.karaf/apache-camel/${version:camel}/xml/features
</featureRepos>
<bundles>
mvn:mysql/mysql-connector-java/5.1.34
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_3
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.serp/1.14.1_1
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections/3.2.1_3
mvn:org.apache.openjpa/openjpa/2.3.0
</bundles>
</configuration>
</plugin>
blueprint.xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"
>
<jaxrs:server id="organizationService" address="/common">
<jaxrs:serviceBeans>
<ref component-id="organizationServiceBean"/>
</jaxrs:serviceBeans>
<jaxrs:features>
<bean class="org.apache.cxf.jaxrs.swagger.SwaggerFeature"/>
</jaxrs:features>
</jaxrs:server>
<cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus>
<bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://127.0.0.1:3306/test"/>
<property name="username" value="user"/>
<property name="password" value="pwd"/>
</bean>
<service ref="dataSource" interface="javax.sql.DataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/DataSource"/>
</service-properties>
</service>
<bean id="defOrganizationService" class="org.OrganizationDataServiceImpl">
<jpa:context unitname="PERSON"/>
<tx:transaction method="*" value="Required"/>
</bean>
<bean id="defOrgchartService" class="org.OrgchartDataServiceImpl">
<jpa:context unitname="PERSON"/>
<tx:transaction method="*" value="Required"/>
</bean>
<bean id="organizationServiceBean" class="org.OrganizationService">
<property name="organizationDataService" ref="defOrganizationService"/>
<property name="orgchartDataService" ref="defOrgchartService"/>
</bean>
</blueprint>
persistence.xml
<persistence-unit name="PERSON" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/DataSource)</jta-data-source>
<!-- this is very important -->
<class>org.Person</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<!-- Schema update -->
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
<!-- Specify dialect -->
<property name="openjpa.jdbc.DBDictionary" value="mysql"/>
<property name="openjpa.Log" value="File=C:/install/jboss-fuse-6.1.0.redhat-379/data/log/org.apache.openjpa.log, DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>
</properties>
</persistence-unit>
</persistence>

Pageable support for Spring Data JPA having jndi look up for entityManagerFactory

I was following http://terasolunaorg.github.io/guideline/1.0.x/en/ArchitectureInDetail/Pagination.html to implement Pagination support for my MVC application
When I try to start the JBoss Server,
nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract java.util.List com.repo.MyRepository.searchEntitySC(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.Date,java.lang.String,java.util.Date,java.lang.String,java.lang.String,java.lang.String,org.springframework.data.domain.Pageable)!
Reason: Your persistence provider does not support extracting the JPQL query from a named query thus you can't use Pageable inside your query method. Make sure you have a JpaDialect configured at your EntityManagerFactoryBean as this affects discovering the concrete persistence provider.
I tried to follow, http://forum.spring.io/forum/spring-projects/data/99613-you-cannot-use-pageable-as-method-parameter-if-your-persistence-provider-cannot-extra
But I don't know how to apply the suggested configuration for entityManagerFactory
as my jpa-config.xml contains
<jee:jndi-lookup id="entityManagerFactory" jndi-name="java:jboss/pu/pc" />
Any other better suggestion is more than welcome!
Environment:
JBoss Enterprise Application Platform - Version 6.2.0.GA
spring-data-jpa-1.4.3.RELEASE.jar
hibernate-jpa-2.0-api-1.0.1.Final-redhat-2.jar
standalone.xml contains:
<datasource jndi-name="java:jboss/datasources/pc" pool-name="pcdatapool" enabled="true" use-ccm="false">
<connection-url>jdbc:oracle:thin:#localhost:1521:mysid</connection-url>
<driver>oracle</driver>
<security>
<user-name>XXX</user-name>
<password>xxx</password>
</security>
</datasource>
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://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="pcem">
<jta-data-source>java:jboss/datasources/pc</jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
<class>xxx.YYYYY</class>
...
<class>yyyy.AAAAAAAAAA</class>
<properties>
<property name="hibernate.jdbc.batch_size" value="50" />
<property name="hibernate.default_batch_fetch_size" value="50" />
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<!-- Use log category 'org.hibernate.SQL' to level 'debug' to output SQL from hibernate -->
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false"/>
<!-- Use generate statistics this will help query performance tunning -->
<property name="hibernate.generate_statistics" value="false"/>
</properties>
</persistence-unit>
In the standalone.xml file remove the prefix java:. Then in persistence config file reference the jndi name you have in your standalone.xml but with the prefix. So:
persistence.xml
<jee:jndi-lookup id="myDatasource" jndi-name="java:jboss/datasources/pc" />
<mapping-file>META-INF/announcement-queries.hbm.xml</mapping-file>
jboss.datasource.xml
<datasource jndi-name="jboss/datasources/pc" pool-name="pcdatapool" enabled="true" use-ccm="false">
...
</datasource>
applicationContext.xml (Spring)
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myDatasource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="generateDdl" value="false" />
<property name="showSql" value="${hibernate.show_sql}" />
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.use_sql_comments">${hibernate.format_sql}</prop>
<prop key="hibernate.connection.isolation">1</prop>
<prop key="hibernate.configurationClass">org.hibernate.cfg.AnnotationConfiguration</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
<prop key="hibernate.default_batch_fetch_size">100</prop>
<prop key="hibernate.id.new_generator_mappings">true</prop>
</props>
</property>
<property name="packagesToScan" value="com.mypacjage" />
</bean>

Getting exceptions (Missing descriptor / No [EntityType] was found for the key class) on the below scenario

Getting exceptions (Missing descriptor / No [EntityType] was found for the key class) on below scenario.
Start the weblogic server
Deploy the WAR
Test the application ā€˜nā€™ of times
Delete the WAR from web logic admin console
Re deploy the same WAR
Basically, if we do redeploy we will got the above exception. This issue will get resolved if you restart the server.
Persistence.xml
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>DEV</jta-data-source>
<class>com.Class1</class>
<properties>
<property name="hibernate.show_sql" value="true"/>
<property name="eclipselink.allow-zero-id" value="true"/>
<property name="eclipselink.logging.level" value="FINE" />
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.target-server" value="WebLogic"/>
<property name="javax.persistence.query.timeout" value="120000"/>
<property name="javax.persistence.lock.timeout" value="120000"/>
</properties>
</persistence-unit>
Bean Configuration to handle spring transaction
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceXmlLocation" value="classpath*:META-INF/persistence.xml"/>
<property name="persistenceUnitManager" ref="persistenceUnitManager" />
</bean>
<bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
<property name="persistenceXmlLocations">
<list>
<value>classpath*:META-INF/persistence.xml</value>
</list>
</property>
<property name="loadTimeWeaver" ref="loadTimeWeaver"/>
</bean>
<bean id="loadTimeWeaver" class="org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver"/>
<bean id="em" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
The WL Server throwing this error because of the ServerSession is cached in the EntityManagerSetupImpl static, so on createEntityManagerFactory() the old one is used with the old descriptors/class before the redeployment.
**
We managed to take the EntityManagerFactory Object and closed the same
in the destroy method in one of the InitializerServlet.
**