Tuesday, December 17, 2013

jboss EAP 6.2.0 Test datasource in the Jboss CLI

/host=[hostname]/server=[servername]/subsystem=datasources/data-source=jdbc\/[datasource_name]:test-connection-in-pool Did this post help you in any way can you please leave a comment? This will motivate me writing more posts.

Friday, November 22, 2013

ldapsearch OID 10.1.4 Find all groups an member belongs to

$ORACLE_HOME/bin/ldapsearch -h $ldapurl -p $ldapport -D "cn=orcladmin" -w $password -b "dc=acme,dc=nl" -s sub "(&(|(objectclass=orclgroup)(objectclass=orcladgroup))(uniquemember=cn={USER},cn=users,dc=acme,dc=nl))" displayname Did this post help you in any way can you please leave a comment? This will motivate me writing more posts.

Monday, November 4, 2013

Create JBoss EAP 6.1 default profile with jboss-cli.sh

I made a shell function to create (copy) the default profile of JBoss EAP 6.1:
function create_profile
{
$JBOSS_HOME/bin/jboss-cli.sh -c --controller=${host}:${port} >> $LOG_FILE 2>&1 <"${2}_server.log","relative-to"=>"jboss.server.log.dir"},suffix=".yyyy-MM-dd",append=true)
/profile=${1}/subsystem=logging/logger="com.arjuna":add(level=WARN)
/profile=${1}/subsystem=logging/logger="org.apache.tomcat.util.modeler":add(level=WARN)
/profile=${1}/subsystem=logging/logger="org.jboss.as.config":add(level=DEBUG)
/profile=${1}/subsystem=logging/logger="sun.rmi":add(level=WARN)
/profile=${1}/subsystem=logging/logger="jacorb":add(level=WARN)
/profile=${1}/subsystem=logging/logger="jacorb.config":add(level=ERROR)

/profile=${1}/subsystem=logging/root-logger=ROOT:add
/profile=${1}/subsystem=logging/root-logger=ROOT:write-attribute(name="level", value="INFO")
/profile=${1}/subsystem=logging/root-logger=ROOT:root-logger-assign-handler(name="FILE")

/profile=${1}/subsystem=configadmin:add()

  # Create datasources subsystem
/profile=${1}/subsystem=datasources:add()
/profile=${1}/subsystem=datasources/jdbc-driver=OracleJDBCDriver/:add(driver-name="OracleJDBCDriver", driver-module-name="oracle.jdbc", driver-xa-datasource-class-name="oracle.jdbc.driver.OracleDriver")

  # Create ee subsystem:
/profile=${1}/subsystem=ee:add(spec-descriptor-property-replacement="false",jboss-descriptor-property-replacement="true")

/profile=${1}/subsystem=ejb3:add(default-missing-method-permissions-deny-access=true,,default-security-domain=other)
/profile=${1}/subsystem=ejb3:write-attribute(name=default-slsb-instance-pool,value=slsb-strict-max-pool)
/profile=${1}/subsystem=ejb3:write-attribute(name=default-sfsb-cache,value=simple)
/profile=${1}/subsystem=ejb3:write-attribute(name=default-stateful-bean-access-timeout, value=5000)
/profile=${1}/subsystem=ejb3:write-attribute(name=default-singleton-bean-access-timeout, value=5000)
/profile=${1}/subsystem=ejb3/strict-max-bean-instance-pool=slsb-strict-max-pool:add(max-pool-size=20,timeout=5,timeout-unit=MINUTES)
/profile=${1}/subsystem=ejb3/strict-max-bean-instance-pool=mdb-strict-max-pool:add(max-pool-size=20,timeout=5,timeout-unit=MINUTES)
/profile=${1}/subsystem=ejb3/cache=simple:add(aliases=["NoPassivationCache"])
/profile=${1}/subsystem=ejb3/cache=passivating:add(passivation-store=file,aliases=["SimpleStatefulCache"])
/profile=${1}/subsystem=ejb3/file-passivation-store=file:add
/profile=${1}/subsystem=ejb3/service=async:add(thread-pool-name=default)
/profile=${1}/subsystem=ejb3/service=timer-service:add(thread-pool-name=default,path=timer-service-data,relative-to=jboss.server.data.dir)
/profile=${1}/subsystem=ejb3/service=remote:add(connector-ref=remoting-connector,thread-pool-name=default)
/profile=${1}/subsystem=ejb3/thread-pool=default:add(max-threads=10,keepalive-time={"time"=>"100","unit"=>"MILLISECONDS"})

# Create infinispan subsystem:
/profile=${1}/subsystem=infinispan:add
/profile=${1}/subsystem=infinispan/cache-container=web:add(aliases=["standard-session-cache"],default-cache="local-web",module="org.jboss.as.clustering.web.infinispan")
/profile=${1}/subsystem=infinispan/cache-container=web/local-cache=local-web:add(batching=true)
/profile=${1}/subsystem=infinispan/cache-container=web/local-cache=local-web/file-store=FILE_STORE:add(passivation=false,purge=false)

/profile=${1}/subsystem=infinispan/cache-container=hibernate:add(default-cache=local-query,module="org.jboss.as.jpa.hibernate:4")
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=entity:add
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=entity/transaction=TRANSACTION:add(mode=NON_XA)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=entity/eviction=EVICTION:add(strategy=LRU,max-entries=10000)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=entity/expiration=EXPIRATION:add(max-idle=100000)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=local-query:add
/profile=${1}/function create_profile
{
$JBOSS_HOME/bin/jboss-cli.sh -c --controller=${host}:${port} >> $LOG_FILE 2>&1 <"${2}_server.log","relative-to"=>"jboss.server.log.dir"},suffix=".yyyy-MM-dd",append=true)
/profile=${1}/subsystem=logging/logger="com.arjuna":add(level=WARN)
/profile=${1}/subsystem=logging/logger="org.apache.tomcat.util.modeler":add(level=WARN)
/profile=${1}/subsystem=logging/logger="org.jboss.as.config":add(level=DEBUG)
/profile=${1}/subsystem=logging/logger="sun.rmi":add(level=WARN)
/profile=${1}/subsystem=logging/logger="jacorb":add(level=WARN)
/profile=${1}/subsystem=logging/logger="jacorb.config":add(level=ERROR)

/profile=${1}/subsystem=logging/root-logger=ROOT:add
/profile=${1}/subsystem=logging/root-logger=ROOT:write-attribute(name="level", value="INFO")
/profile=${1}/subsystem=logging/root-logger=ROOT:root-logger-assign-handler(name="FILE")

/profile=${1}/subsystem=configadmin:add()

  # Create datasources subsystem
/profile=${1}/subsystem=datasources:add()
/profile=${1}/subsystem=datasources/jdbc-driver=OracleJDBCDriver/:add(driver-name="OracleJDBCDriver", driver-module-name="oracle.jdbc", driver-xa-datasource-class-name="oracle.jdbc.driver.OracleDriver")

  # Create ee subsystem:
/profile=${1}/subsystem=ee:add(spec-descriptor-property-replacement="false",jboss-descriptor-property-replacement="true")

/profile=${1}/subsystem=ejb3:add(default-missing-method-permissions-deny-access=true,,default-security-domain=other)
/profile=${1}/subsystem=ejb3:write-attribute(name=default-slsb-instance-pool,value=slsb-strict-max-pool)
/profile=${1}/subsystem=ejb3:write-attribute(name=default-sfsb-cache,value=simple)
/profile=${1}/subsystem=ejb3:write-attribute(name=default-stateful-bean-access-timeout, value=5000)
/profile=${1}/subsystem=ejb3:write-attribute(name=default-singleton-bean-access-timeout, value=5000)
/profile=${1}/subsystem=ejb3/strict-max-bean-instance-pool=slsb-strict-max-pool:add(max-pool-size=20,timeout=5,timeout-unit=MINUTES)
/profile=${1}/subsystem=ejb3/strict-max-bean-instance-pool=mdb-strict-max-pool:add(max-pool-size=20,timeout=5,timeout-unit=MINUTES)
/profile=${1}/subsystem=ejb3/cache=simple:add(aliases=["NoPassivationCache"])
/profile=${1}/subsystem=ejb3/cache=passivating:add(passivation-store=file,aliases=["SimpleStatefulCache"])
/profile=${1}/subsystem=ejb3/file-passivation-store=file:add
/profile=${1}/subsystem=ejb3/service=async:add(thread-pool-name=default)
/profile=${1}/subsystem=ejb3/service=timer-service:add(thread-pool-name=default,path=timer-service-data,relative-to=jboss.server.data.dir)
/profile=${1}/subsystem=ejb3/service=remote:add(connector-ref=remoting-connector,thread-pool-name=default)
/profile=${1}/subsystem=ejb3/thread-pool=default:add(max-threads=10,keepalive-time={"time"=>"100","unit"=>"MILLISECONDS"})

# Create infinispan subsystem:
/profile=${1}/subsystem=infinispan:add
/profile=${1}/subsystem=infinispan/cache-container=web:add(aliases=["standard-session-cache"],default-cache="local-web",module="org.jboss.as.clustering.web.infinispan")
/profile=${1}/subsystem=infinispan/cache-container=web/local-cache=local-web:add(batching=true)
/profile=${1}/subsystem=infinispan/cache-container=web/local-cache=local-web/file-store=FILE_STORE:add(passivation=false,purge=false)

/profile=${1}/subsystem=infinispan/cache-container=hibernate:add(default-cache=local-query,module="org.jboss.as.jpa.hibernate:4")
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=entity:add
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=entity/transaction=TRANSACTION:add(mode=NON_XA)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=entity/eviction=EVICTION:add(strategy=LRU,max-entries=10000)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=entity/expiration=EXPIRATION:add(max-idle=100000)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=local-query:add
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=local-query/transaction=TRANSACTION:add(mode=NONE)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=local-query/expiration=EXPIRATION:add(max-idle=100000)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=local-query/eviction=EVICTION:add(strategy=LRU,max-entries=10000)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=timestamps:add
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=timestamps/transaction=TRANSACTION:add(mode=NONE)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=timestamps/eviction=EVICTION:add(strategy=NONE)

# Create jaxrs subsystem:
/profile=${1}/subsystem=jaxrs:add()

# Create jca subsystem:
/profile=${1}/subsystem=jca:add()
/profile=${1}/subsystem=jca/archive-validation=archive-validation:add(enabled=true, fail-on-error=true, fail-on-warn=false)
/profile=${1}/subsystem=jca/bean-validation=bean-validation:add(enabled=true)
/profile=${1}/subsystem=jca/cached-connection-manager=cached-connection-manager:add(install=true)
/profile=${1}/subsystem=jca/workmanager=default:add(name=default)
/profile=${1}/subsystem=jca/workmanager=default/short-running-threads=default:add(core-threads=50,queue-length=50,max-threads=50,keepalive-time={"time"=>"10", "unit"=>"SECONDS"})
/profile=${1}/subsystem=jca/workmanager=default/long-running-threads=default:add(core-threads=50,queue-length=50,max-threads=50,keepalive-time={"time"=>"10", "unit"=>"SECONDS"})

/profile=${1}/subsystem=jdr:add
  
# Create jmx subsystem:
/profile=${1}/subsystem=jmx:add(show-model=true)
/profile=${1}/subsystem=jmx/expose-model=resolved:add
/profile=${1}/subsystem=jmx/expose-model=expression:add

# Create jpa subsystem:
/profile=${1}/subsystem=jpa:add(default-datasource="", default-extended-persistence-inheritance="DEEP")
/profile=${1}/subsystem=jsf:add

/profile=${1}/subsystem=mail:add
/profile=${1}/subsystem=mail/mail-session="java:jboss/mail/Default":add(jndi-name=java:jboss/mail/Default,debug=false)
/profile=${1}/subsystem=mail/mail-session="java:jboss/mail/Default"/server=smtp:add(outbound-socket-binding-ref=mail-smtp)

/profile=${1}/subsystem=naming:add()
# remove this command if a 7.1.1 server is used
/profile=${1}/subsystem=naming/service=remote-naming:add
/profile=${1}/subsystem=pojo:add
/profile=${1}/subsystem=remoting:add
/profile=${1}/subsystem=remoting/connector=remoting-connector:add(socket-binding=remoting, security-realm=ApplicationRealm)

  
  # Create resource-adapters subsystem:
/profile=${1}/subsystem=resource-adapters:add()
/profile=${1}/subsystem=sar:add

/profile=${1}/subsystem=security:add
/profile=${1}/subsystem=security/security-domain=other:add(cache-type=default)
/profile=${1}/subsystem=security/security-domain=other/authentication=classic:add(login-modules=[{"code"=>"Remoting","flag"=>"optional","module-options"=>[("password-stacking"=>"useFirstPass")]},{"code"=>"RealmDirect","flag"=>"required","module-options"=>[("password-stacking"=>"useFirstPass")]}])
/profile=${1}/subsystem=security/security-domain=jboss-web-policy:add(cache-type=default)
/profile=${1}/subsystem=security/security-domain=jboss-web-policy/authorization=classic:add(policy-modules=[{"code"=>"Delegating","flag"=>"required"}])
/profile=${1}/subsystem=security/security-domain=jboss-ejb-policy:add(cache-type=default)
/profile=${1}/subsystem=security/security-domain=jboss-ejb-policy/authorization=classic:add(policy-modules=[{"code"=>"Delegating","flag"=>"required"}])

  # Create threads subsystem:
/profile=${1}/subsystem=threads:add()

/profile=${1}/subsystem=transactions/:add(socket-binding="txn-recovery-environment",status-socket-binding="txn-status-manager",process-id-uuid=true,default-timeout=300)
  
# Create web subsystem:
/profile=${1}/subsystem=web:add(default-virtual-server="default-host", native="false")
/profile=${1}/subsystem=web/connector=http:add(protocol="HTTP/1.1",socket-binding="http",scheme="http")
/profile=${1}/subsystem=web/virtual-server="default-host":add(alias=["localhost","example.com"])

/profile=${1}/subsystem=webservices:add(modify-wsdl-address=true,wsdl-host="\${jboss.bind.address:127.0.0.1}")
/profile=${1}/subsystem=webservices/endpoint-config=Standard-Endpoint-Config:add
/profile=${1}/subsystem=webservices/endpoint-config=Recording-Endpoint-Config:add
/profile=${1}/subsystem=webservices/endpoint-config=Recording-Endpoint-Config/pre-handler-chain=recording-handlers:add(protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM")



/profile=${1}/subsystem=webservices/endpoint-config=Recording-Endpoint-Config/pre-handler-chain=recording-handlers/handler=RecordingHandler:add(class="org.jboss.ws.common.invocation.RecordingServerHandler")
/profile=${1}/subsystem=webservices/client-config=Standard-Client-Config:add

/profile=${1}/subsystem=weld:add

run-batch 
EOF
}subsystem=infinispan/cache-container=hibernate/local-cache=local-query/transaction=TRANSACTION:add(mode=NONE)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=local-query/expiration=EXPIRATION:add(max-idle=100000)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=local-query/eviction=EVICTION:add(strategy=LRU,max-entries=10000)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=timestamps:add
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=timestamps/transaction=TRANSACTION:add(mode=NONE)
/profile=${1}/subsystem=infinispan/cache-container=hibernate/local-cache=timestamps/eviction=EVICTION:add(strategy=NONE)

# Create jaxrs subsystem:
/profile=${1}/subsystem=jaxrs:add()

# Create jca subsystem:
/profile=${1}/subsystem=jca:add()
/profile=${1}/subsystem=jca/archive-validation=archive-validation:add(enabled=true, fail-on-error=true, fail-on-warn=false)
/profile=${1}/subsystem=jca/bean-validation=bean-validation:add(enabled=true)
/profile=${1}/subsystem=jca/cached-connection-manager=cached-connection-manager:add(install=true)
/profile=${1}/subsystem=jca/workmanager=default:add(name=default)
/profile=${1}/subsystem=jca/workmanager=default/short-running-threads=default:add(core-threads=50,queue-length=50,max-threads=50,keepalive-time={"time"=>"10", "unit"=>"SECONDS"})
/profile=${1}/subsystem=jca/workmanager=default/long-running-threads=default:add(core-threads=50,queue-length=50,max-threads=50,keepalive-time={"time"=>"10", "unit"=>"SECONDS"})

/profile=${1}/subsystem=jdr:add
  
# Create jmx subsystem:
/profile=${1}/subsystem=jmx:add(show-model=true)
/profile=${1}/subsystem=jmx/expose-model=resolved:add
/profile=${1}/subsystem=jmx/expose-model=expression:add

# Create jpa subsystem:
/profile=${1}/subsystem=jpa:add(default-datasource="", default-extended-persistence-inheritance="DEEP")
/profile=${1}/subsystem=jsf:add

/profile=${1}/subsystem=mail:add
/profile=${1}/subsystem=mail/mail-session="java:jboss/mail/Default":add(jndi-name=java:jboss/mail/Default,debug=false)
/profile=${1}/subsystem=mail/mail-session="java:jboss/mail/Default"/server=smtp:add(outbound-socket-binding-ref=mail-smtp)

/profile=${1}/subsystem=naming:add()
# remove this command if a 7.1.1 server is used
/profile=${1}/subsystem=naming/service=remote-naming:add
/profile=${1}/subsystem=pojo:add
/profile=${1}/subsystem=remoting:add
/profile=${1}/subsystem=remoting/connector=remoting-connector:add(socket-binding=remoting, security-realm=ApplicationRealm)

  
  # Create resource-adapters subsystem:
/profile=${1}/subsystem=resource-adapters:add()
/profile=${1}/subsystem=sar:add

/profile=${1}/subsystem=security:add
/profile=${1}/subsystem=security/security-domain=other:add(cache-type=default)
/profile=${1}/subsystem=security/security-domain=other/authentication=classic:add(login-modules=[{"code"=>"Remoting","flag"=>"optional","module-options"=>[("password-stacking"=>"useFirstPass")]},{"code"=>"RealmDirect","flag"=>"required","module-options"=>[("password-stacking"=>"useFirstPass")]}])
/profile=${1}/subsystem=security/security-domain=jboss-web-policy:add(cache-type=default)
/profile=${1}/subsystem=security/security-domain=jboss-web-policy/authorization=classic:add(policy-modules=[{"code"=>"Delegating","flag"=>"required"}])
/profile=${1}/subsystem=security/security-domain=jboss-ejb-policy:add(cache-type=default)
/profile=${1}/subsystem=security/security-domain=jboss-ejb-policy/authorization=classic:add(policy-modules=[{"code"=>"Delegating","flag"=>"required"}])

  # Create threads subsystem:
/profile=${1}/subsystem=threads:add()

/profile=${1}/subsystem=transactions/:add(socket-binding="txn-recovery-environment",status-socket-binding="txn-status-manager",process-id-uuid=true,default-timeout=300)
  
# Create web subsystem:
/profile=${1}/subsystem=web:add(default-virtual-server="default-host", native="false")
/profile=${1}/subsystem=web/connector=http:add(protocol="HTTP/1.1",socket-binding="http",scheme="http")
/profile=${1}/subsystem=web/virtual-server="default-host":add(alias=["localhost","example.com"])

/profile=${1}/subsystem=webservices:add(modify-wsdl-address=true,wsdl-host="\${jboss.bind.address:127.0.0.1}")
/profile=${1}/subsystem=webservices/endpoint-config=Standard-Endpoint-Config:add
/profile=${1}/subsystem=webservices/endpoint-config=Recording-Endpoint-Config:add
/profile=${1}/subsystem=webservices/endpoint-config=Recording-Endpoint-Config/pre-handler-chain=recording-handlers:add(protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM")



/profile=${1}/subsystem=webservices/endpoint-config=Recording-Endpoint-Config/pre-handler-chain=recording-handlers/handler=RecordingHandler:add(class="org.jboss.ws.common.invocation.RecordingServerHandler")
/profile=${1}/subsystem=webservices/client-config=Standard-Client-Config:add

/profile=${1}/subsystem=weld:add

run-batch 
EOF
}
Did this post help you in any way can you please leave a comment? This will motivate me writing more posts.