>My question is... is there supposed to be more to the TomEE GUI? All I get
>is a list of directories, but I have seen some screenshots that look like
>there should be options of testing the environment setup.

Yep. The GUI is simple but it comes with a handy scripting console (groovy
and javascript). It is not part of the main distribution because it would
increase the size of the final tar.gz/zip files. It's called "webaccess".
It's not a configuration interface but a testing environment. It uses
jax-rs, so it requires "Apache TomEE JAX-RS" or "Apache TomEE Plus".

All you need to do is to drop the webaccess war file into the "webapps"
directory. It requires an user with the "tomee-admin" rule.
http://repo1.maven.org/maven2/org/apache/openejb/tomee-webaccess/1.6.0/tomee-webaccess-1.6.0.war

You should see something like this
https://dl.dropboxusercontent.com/u/1459144/tomee-list/webaccess.png

See the sort of groovy scripts you could use...

// list system properties
System.properties.stringPropertyNames().each { name ->
  def value = System.properties.get(name)
  println("$name = $value")
}

// list system runtime info
import java.lang.management.ManagementFactory

def osBean = ManagementFactory.getOperatingSystemMXBean()
def runtime = Runtime.getRuntime()
def memoryBean = ManagementFactory.getMemoryMXBean()

println("""System info =
  load => ${osBean.getSystemLoadAverage()}
  memoryBean => ${ManagementFactory.getMemoryMXBean()}
  free => ${runtime.freeMemory()}
  total => ${runtime.totalMemory()}
  heap => ${memoryBean.getHeapMemoryUsage()}
  nonHeap => ${memoryBean.getNonHeapMemoryUsage()}
""")

// list all threads
Thread.allStackTraces.keySet().each { thread ->
  println("${thread.name}: ${thread.state}")
}

// list threads
import java.lang.management.ManagementFactory

def threadsBean = ManagementFactory.threadMXBean
threadsBean.allThreadIds.each { id ->
  def info = threadsBean.getThreadInfo(id)
  println("""Thread info [${info.threadName}]=
  state => ${info.threadState}
  lockInfo => ${info.lockInfo?.className}
""")
}

// get "tomee" sessions
import java.lang.management.ManagementFactory
import javax.management.ObjectName
import java.util.Date

def server = ManagementFactory.getPlatformMBeanServer()
def mbean = server.getObjectInstance(new
ObjectName('Catalina:type=Manager,context=/tomee,host=localhost'))

def maxInactiveInterval = server.getAttribute(mbean.objectName,
'maxInactiveInterval')
def result = server.invoke(mbean.objectName, 'listSessionIds', null,
null).split(' ').each {
  def accessedTs = new Date(server.invoke(mbean.objectName,
'getLastAccessedTimestamp', [it] as Object[], [String.class.name] as
String[]))
  def expirationTs = new Date(maxInactiveInterval * 1000 + accessedTs.time)
  def creationTs = new Date(server.invoke(mbean.objectName,
'getCreationTimestamp', [it] as Object[], [String.class.name] as String[]))
  println("$it [CreationTime: $creationTs; LastAccessedTime: $accessedTs;
Expires: $expirationTs]")
}

// Show rest endpoints
import org.apache.openejb.loader.SystemInstance
import org.apache.openejb.server.rest.RsRegistry
import org.apache.openejb.monitoring.LocalMBeanServer

def mbeanServer = LocalMBeanServer.get()
def registry = SystemInstance.get().getComponent(RsRegistry)
registry.listeners.each { key, listener ->
  listener.jmxNames.each { name ->
    mbeanServer.getAttribute(name, 'operations').values().each { ops ->
      ops.compositeType.keySet().each {
        println(it)
      }
    }
  }
}

// See mbeans
import java.lang.management.ManagementFactory

def server = ManagementFactory.getPlatformMBeanServer()
def beans = server.queryMBeans(null, null)
println("We have ${(beans ? beans.size() : 0)} bean(s)")

def getValue = { bean, attr ->
  try {
  return server.getAttribute(bean.objectName, attr.name)
  } catch (ignore) {
  return 'NA'
  }
}

def printAttributes = { bean ->
  def info = server.getMBeanInfo(bean.objectName)
  info?.getAttributes()?.each {
    println("    '${it.name}' = ${getValue(bean, it)}")
  }
}

beans?.each { bean ->
  println()
  println("Bean '${bean.objectName}'")
  println("  class: ${bean.className}")
  printAttributes(bean)
}


[]s,
Thiago.


On Wed, Jan 15, 2014 at 9:51 PM, nabble <[email protected]>wrote:

> I have extracted apache-tomee-webprofile-1.6.0, added the required roles
> (tomee-admin,manager-gui,manager-script,manager-jmx,manager-status) and
> started with ./startup.sh
>
> My question is... is there supposed to be more to the TomEE GUI? All I get
> is a list of directories, but I have seen some screenshots that look like
> there should be options of testing the environment setup.
>
> Also, in the list of directories that I see, all values are populated
> (correctly) except openEJBTomcatLoaderJar and openEJBJavaagentJar which are
> blank. Should they auto-populate, or is there somewhere I need to specify
> these values?
>
> Wondering also what openEJBLibDir should actually be. It auto-populated as
> /opt/apache-tomee-webprofile-1.6.0/webapps/tomee/lib but based on
> <http://tomee.apache.org/tomee-webapp.html> I would think that the proper
> value should be /opt/apache-tomee-webprofile-1.6.0/lib
>
> I have also tried apache-tomee-webprofile-1.6.1-SNAPSHOT to see if the
> results were any different. They werent, with the exception of the names of
> the roles - changed from manager-gui and manager-script to admin-gui and
> admin-script. Whats that all about?
>
> Any insight is greatly appreciated. Also, I would be more than willing to
> help with documentation on the project. I see a lot of DEV related
> documentation/examples, but not much from an infrastructure resource
> perspective, which I could offer.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/TomEE-config-questions-tp4667192.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Reply via email to