Configuring JOnAS

After you have downloaded the JOnAS source distribution as described in the section Getting the Source Distribution, you must compile it. If you downloaded the binary distribution you can go directly to the section Setting Your Environment.

Compiling the Source Distribution with Ant

Setting Your Environment

Once you have installed your JOnAS distribution, you have to setup the JONAS_ROOT environment variable prior to using JOnAS or any of its tools. You will also have to update your PATH as well.

Here are examples of setting your environment for Unix and Windows platforms:

Checking That Everything is Correct

JOnAS is provided with a tool called jonas.bat for Windows and jonas for Unix that checks if your environment is correctly set.

If everything is set correctly, just run jonas check and you should obtain an output like:
JONAS_BASE is set to C:\jonas-3-2-2

- JONAS_ROOT value:
   C:\jonas-3-2-2

- JONAS_BASE value:
   C:\jonas-3-2-2

- JOnAS Services:
   registry,jmx,jtm,dbm,security,jms,resource,ejb,web,ear

- Contents of 'jonas.properties':
   jonas.transaction.propagation = true
   jonas.service.web.autoloaddir = autoload
   jonas.service.ws.file1.type = file
   jonas.service.registry.class = org.objectweb.jonas.registry.RegistryServiceImpl
   jonas.service.ws.parsingwithvalidation = true
   jonas.service.jtm.remote = false
   jonas.service.security.class = org.objectweb.jonas.security.JonasSecurityServiceImpl
   jonas.service.jms.collocated = true
   jonas.service.ear.descriptors =
   jonas.service.web.class = org.objectweb.jonas.web.catalina41.CatalinaJWebContainerServiceImpl
   jonas.service.jms.topics = sampleTopic
   jonas.service.jms.mom = org.objectweb.jonas_jms.JmsAdminForJoram
   jonas.service.ejb.mdbthreadpoolsize = 10
   jonas.service.ear.class = org.objectweb.jonas.ear.EarServiceImpl
   jonas.security.propagation = true
   jonas.service.ws.factory.class = org.objectweb.jonas.ws.axis.JAxisServiceFactory
   jonas.service.mail.factories =
   jonas.service.ear.parsingwithvalidation = true
   jonas.service.mail.class = org.objectweb.jonas.mail.MailServiceImpl
   jonas.service.jms.class = org.objectweb.jonas.jms.JmsServiceImpl
   jonas.service.ejb.parsingwithvalidation = false
   jonas.service.jmx.class = org.objectweb.jonas.jmx.sunri.JmxServiceImpl
   jonas.service.ear.autoloaddir = autoload
   jonas.service.ws.wsdlhandlers = file1
   jonas.service.ws.class = org.objectweb.jonas.ws.AxisWSServiceImpl
   jonas.service.jms.queues = sampleQueue
   jonas.services = registry,jmx,jtm,dbm,security,jms,resource,ejb,web,ear
   jonas.service.resource.class = org.objectweb.jonas.resource.ResourceServiceImpl
   jonas.service.ejb.descriptors =
   jonas.service.jtm.timeout = 60
   jonas.service.ejb.mdbmaxthreadpoolsize = 25
   jonas.service.security.ejbrealm = memrlm_1
   jonas.service.web.parsingwithvalidation = true
   jonas.service.ws.file1.location = /var/wsdl
   jonas.service.ejb.autoloaddir = autoload
   jonas.service.dbm.datasources =
   jonas.log.configfile = trace
   jonas.service.registry.mode = automatic
   jonas.orb.port = 0
   jonas.service.web.descriptors =
   jonas.service.jtm.class = org.objectweb.jonas.jtm.TransactionServiceImpl
   jonas.service.dbm.class = org.objectweb.jonas.dbm.DataBaseServiceImpl
   jonas.service.ejb.class = org.objectweb.jonas.container.EJBServiceImpl
   jonas.service.resource.resources =
   jonas.service.resource.autoloaddir = autoload

- Contents of 'trace.properties':
  (file:/C:/jonas-3-2-2/conf/trace.properties)
   logger.root.level = INFO
   handler.mesonly.output = System.out
   handler.logf.pattern = %d : %l : %h : %O{1}.%M :    %m%n
   logger.org.objectweb.jonas.wsgen.additivity = false
   logger.org.objectweb.jonas.genic.additivity = false
   handler.tty.pattern = %d : %O{1}.%M : %m%n
   logger.org.objectweb.jorm.level = WARN
   logger.root.handler.1 = logf
   logger.org.objectweb.medor.level = WARN
   logger.root.handler.0 = tty
   logger.org.objectweb.level = INFO
   logger.org.objectweb.jonas.genic.level = INFO
   handler.tty.type = Console
   logger.org.objectweb.jonas.genic.handler.0 = mesonly
   logger.org.objectweb.jonas.wsgen.handler.1 = tty
   logger.org.objectweb.jonas.wsgen.handler.0 = mesonly
   logger.org.objectweb.jonas.wsgen.level = DEBUG
   logger.org.objectweb.jonas.jdbc.sql.level = DEBUG
   handler.logf.type = File
   handler.tty.output = System.out
   handler.logf.output = automatic
   logger.fr.dyade.aaa.level = ERROR
   handler.mesonly.type = Console
   handler.mesonly.pattern = %m%n
   log.config.classname = org.objectweb.util.monolog.wrapper.log4j.MonologLoggerFactory

- Contents of 'carol.properties':
  (file:/C:/jonas-3-2-2/conf/carol.properties)
   carol.cmi.multicast.groupname = G1
   carol.jrmp.url = rmi://localhost:1099
   carol.jeremie.url = jrmi://localhost:2000
   carol.protocols = jrmp
   carol.cmi.stub.debug = false
   carol.iiop.url = iiop://localhost:2001
   carol.cmi.rr.factor = 100
   carol.jndi.java.naming.factory.url.pkgs = org.objectweb.jonas.naming
   carol.cmi.url = cmi://localhost:2002

- Check 'jonas-realm.xml':
  File is present.

The JOnAS environment seems correct.

Congratulations ! You are now ready to use JOnAS and run your first EJB application

Additional Options at JOnAS Startup

In some cases you may want to give some specific options to the JVM that will execute JOnAS or add jar files for the JOnAS runtime CLASSPATH. This can be achieved by setting the XTRA_CLASSPATH and JAVA_OPTS environment variables before starting JOnAS.

Here is an example adding 2 jar files to the JOnAS runtime CLASSPATH and setting Sun's JVM heap size to 768MB, thread stack size to 128KB and turning on cpu profiling:
bash>export XTRA_CLASSPATH=/users/me/some_jar.jar:/users/me/another_jar.jar
bash>export JAVA_OPTS="-Xmx768m -Xss128k -Xprof"
bash>jonas start

Check your JVM documentation for a complete list of available options.