Remote EJB lookup using OpenEJB in Tomee - openejb

Am trying to use example given here
http://openejb.apache.org/hello-world.html
With OpenEJB I am able to output HelloWorld
I am trying same in Apache Tomee
I have Remote EJB bean like this
#Remote
public interface Hello{
public String sayHello();
}
#Stateless
public class HelloBean implements Hello{
public String sayHello(){
return "Hello World!!!!";
}
}
packed it in a jar
jar cvf hello.jar org
Deployed on Apache Tomee
Tomee Log after deploying hello.jar
03-Oct-2017 15:55:51.778 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Deployed Application(path=/home/ashish/apache-tomee-plus-7.0.2/webapps/manager)
03-Oct-2017 15:55:51.805 INFO [localhost-startStop-1] sun.reflect.DelegatingMethodAccessorImpl.invoke At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
03-Oct-2017 15:55:51.826 INFO [localhost-startStop-1] sun.reflect.DelegatingMethodAccessorImpl.invoke Deployment of web application directory /home/ashish/apache-tomee-plus-7.0.2/webapps/manager has finished in 137 ms
03-Oct-2017 15:55:51.831 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Starting ProtocolHandler [http-nio-8080]
03-Oct-2017 15:55:51.839 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Starting ProtocolHandler [ajp-nio-8009]
03-Oct-2017 15:55:51.845 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Server startup in 5735 ms
03-Oct-2017 15:56:51.874 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.ConfigurationFactory.configureApplication Configuring enterprise application: /home/ashish/apache-tomee-plus-7.0.2/webapps/hello.jar
03-Oct-2017 15:56:51.914 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.InitEjbDeployments.deploy Auto-deploying ejb HelloBean: EjbDeployment(deployment-id=HelloBean)
03-Oct-2017 15:56:51.915 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.AppInfoBuilder.build Enterprise application "/home/ashish/apache-tomee-plus-7.0.2/webapps/hello.jar" loaded.
03-Oct-2017 15:56:51.925 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.createAppClassLoader Creating dedicated application classloader for hello
03-Oct-2017 15:56:51.926 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.createApplication Assembling app: /home/ashish/apache-tomee-plus-7.0.2/webapps/hello.jar
03-Oct-2017 15:56:51.945 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.JndiBuilder.bind Jndi(name=HelloBeanRemote) --> Ejb(deployment-id=HelloBean)
03-Oct-2017 15:56:51.945 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.JndiBuilder.bind Jndi(name=global/hello/HelloBean!org.acme.Hello) --> Ejb(deployment-id=HelloBean)
03-Oct-2017 15:56:51.945 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.JndiBuilder.bind Jndi(name=global/hello/HelloBean) --> Ejb(deployment-id=HelloBean)
03-Oct-2017 15:56:51.969 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.startEjbs Created Ejb(deployment-id=HelloBean, ejb-name=HelloBean, container=Default Stateless Container)
03-Oct-2017 15:56:51.987 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.startEjbs Started Ejb(deployment-id=HelloBean, ejb-name=HelloBean, container=Default Stateless Container)
03-Oct-2017 15:56:51.988 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.createApplication Deployed Application(path=/home/ashish/apache-tomee-plus-7.0.2/webapps/hello.jar)
Now I have created void main class and trying to access this EJB
It throws error
My Main Class
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
public class HelloClient {
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
//props.put(Context.PROVIDER_URL, "ejbd://127.0.0.1:4201");
//props.put(Context.PROVIDER_URL, "ejbd://localhost:8080");
//props.put(Context.PROVIDER_URL, " http://localhost:8080/openejb/ejb");
Context ctx = new InitialContext(props);
Object ref = ctx.lookup("HelloBeanRemote");
Hello h = (Hello) PortableRemoteObject.narrow(ref, Hello.class);
String result = h.sayHello();
System.out.println(result);
}
}
using : props.put(Context.PROVIDER_URL, "ejbd://127.0.0.1:4201");
run:
Oct 03, 2017 7:12:26 PM org.apache.openejb.client.StickToLastServerConnectionFactoryStrategy connect
WARNING: Cannot connect to server(s): 127.0.0.1:4201 Exception:
java.net.ConnectException: Cannot connect to server 'ejbd://127.0.0.1:4201'. Check that the server is started and that the specified serverURL is correct.
at org.apache.openejb.client.SocketConnectionFactory$SocketConnection.open(SocketConnectionFactory.java:55)
at org.apache.openejb.client.SocketConnectionFactory.getConnection(SocketConnectionFactory.java:35)
at org.apache.openejb.client.ConnectionManager.getConnection(ConnectionManager.java:43)
at org.apache.openejb.client.StickToLastServerConnectionFactoryStrategy.connect(StickToLastServerConnectionFactoryStrategy.java:70)
at org.apache.openejb.client.StickToLastServerConnectionFactoryStrategy.connect(StickToLastServerConnectionFactoryStrategy.java:47)
at org.apache.openejb.client.ServerMetaData.connect(ServerMetaData.java:57)
at org.apache.openejb.client.Client.processRequest(Client.java:58)
at org.apache.openejb.client.Client.request(Client.java:42)
at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at java8demo.HelloClient.main(HelloClient.java:25)
Exception in thread "main" javax.naming.NamingException: Cannot lookup '/HelloBeanRemote'. [Root exception is java.rmi.RemoteException: Cannot connect to any servers: Server #0: ejbd://127.0.0.1:4201]
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at java8demo.HelloClient.main(HelloClient.java:25)
Caused by: java.rmi.RemoteException: Cannot connect to any servers: Server #0: ejbd://127.0.0.1:4201
at org.apache.openejb.client.StickToLastServerConnectionFactoryStrategy.connect(StickToLastServerConnectionFactoryStrategy.java:66)
at org.apache.openejb.client.ServerMetaData.connect(ServerMetaData.java:57)
at org.apache.openejb.client.Client.processRequest(Client.java:58)
at org.apache.openejb.client.Client.request(Client.java:42)
at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
... 2 more
/home/ashish/.cache/netbeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)
using: props.put(Context.PROVIDER_URL, "ejbd://localhost:8080");
run:
Exception in thread "main" javax.naming.NamingException: Cannot lookup '/HelloBeanRemote'. [Root exception is java.rmi.RemoteException: Cannot open object output stream to server: ; nested exception is:
java.net.SocketException: Broken pipe (Write failed)]
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at java8demo.HelloClient.main(HelloClient.java:25)
Caused by: java.rmi.RemoteException: Cannot open object output stream to server: ; nested exception is:
java.net.SocketException: Broken pipe (Write failed)
at org.apache.openejb.client.Client.processRequest(Client.java:107)
at org.apache.openejb.client.Client.request(Client.java:42)
at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
... 2 more
Caused by: java.net.SocketException: Broken pipe (Write failed)
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1877)
at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1786)
at java.io.ObjectOutputStream.<init>(ObjectOutputStream.java:247)
at org.apache.openejb.client.Client.processRequest(Client.java:104)
... 5 more
/home/ashish/.cache/netbeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)

By default Tomee doesn't allow Remote EJB lookup
you need to enable it inside Apache-Tomee/conf/system.properties file
// enable remote access
tomee.remote.support = true
// blacklist none
tomee.serialization.class.blacklist = -
// whitelist all classes or you can define your classes
tomee.serialization.class.whitelist = *
openejb.system.apps = true
openejb.servicemanager.enabled = true
once these configuration are changeed, restart tomee and tomee deploy your EJB's
and all EJB's can be accessed using following url
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
p.put(Context.PROVIDER_URL, "http://localhost:8080/tomee/ejb");
final InitialContext ctx = new InitialContext(p);
Hello hbr = (Hello) ctx.lookup("HelloBeanRemote");
One other mistake I was doing that
I used openejb-client-3.0.jar from OpenEJb container
instead of openejb-client-7.0.2.jar from apache lib folder
Use client jar above 3 version

Related

WFLYCTL0085: Failed to parse configuration

I am new to Jboss world and running JBOSS and getting following error while starting.
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /home/manish/Desktop/ometap/wildfly-10.0.0.Final
JAVA: java
JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
=========================================================================
Listening for transport dt_socket at address: 8787
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by __redirected.__SAXParserFactory (file:/home/manish/Desktop/ometap/wildfly-10.0.0.Final/jboss-modules.jar) to constructor com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl()
WARNING: Please consider reporting this to the maintainers of __redirected.__SAXParserFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
13:34:35,267 INFO [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
13:34:35,627 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
13:34:35,798 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
13:34:36,608 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:131)
at org.jboss.as.server.ServerService.boot(ServerService.java:356)
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:299)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.xml.stream.XMLStreamException: WFLYCTL0083: Failed to load module org.wildfly.extension.core-management
at org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:155)
at org.jboss.as.server.parsing.StandaloneXml$DefaultExtensionHandler.parseExtensions(StandaloneXml.java:126)
at org.jboss.as.server.parsing.StandaloneXml_4.readServerElement(StandaloneXml_4.java:218)
at org.jboss.as.server.parsing.StandaloneXml_4.readElement(StandaloneXml_4.java:141)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:103)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:49)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123)
... 3 more
Caused by: java.util.concurrent.ExecutionException: javax.xml.stream.XMLStreamException: WFLYCTL0083: Failed to load module
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:147)
... 11 more
Caused by: javax.xml.stream.XMLStreamException: WFLYCTL0083: Failed to load module
at org.jboss.as.controller.parsing.ExtensionXml.loadModule(ExtensionXml.java:196)
at org.jboss.as.controller.parsing.ExtensionXml.access$000(ExtensionXml.java:69)
at org.jboss.as.controller.parsing.ExtensionXml$1.call(ExtensionXml.java:127)
at org.jboss.as.controller.parsing.ExtensionXml$1.call(ExtensionXml.java:124)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: org.jboss.modules.ModuleNotFoundException: org.wildfly.extension.core-management:main
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:223)
at org.jboss.as.controller.parsing.ExtensionXml.loadModule(ExtensionXml.java:178)
... 8 more
13:34:36,611 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
13:34:36,615 INFO [org.jboss.as.server] (Thread-1) WFLYSRV0220: Server shutdown has been requested.
13:34:36,681 INFO [org.jboss.as] (MSC service thread 1-3) WFLYSRV0050: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) stopped in 34ms
How can i fix above error?
If you want to use Java 9+ I'd suggest using at least WildFly 15. WildFly 17.0.1.Final is the latest release and does work with Java 9+.
If you are stuck on WildFly 10, I'd suggest using Java 1.8 instead.

Wildfly: AMQ214016: Failed to create netty connect ion java.nio.channels.UnresolvedAddressException from client on natted network

I have a wildfly 10 instance installed in a docker container (Container-A). If I try to look up queues from other containers of the same engine (Server-B, the engine) everything works fine.
I have issues (see trace below), instead, when trying to lookup queues from a virtual machine that is on the same network of the engine (Server-C) using the server-B's IP address on port 7080 that is mapped on the container's 8080 port.
I tryed to open a telnet connection from Server-C to Container-A (using the Server-B ip address and 7080 port) and the connection looks OK.
Can anyone help me??
C:\App>java -jar my-jar.jar
log4j:WARN No appenders could be found for logger (com.myApp.S
etUpBowcaster).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in
fo.
2017-05-30 18:44:01 INFO SetUpBowcaster:? - PROCESSORS BUSES INITIALIZATION
2017-05-30 18:44:01 INFO xnio:93 - XNIO version 3.3.4.Final
2017-05-30 18:44:01 INFO nio:55 - XNIO NIO Implementation Version 3.3.4.Final
2017-05-30 18:44:01 INFO remoting:73 - JBoss Remoting version 4.0.18.Final
2017-05-30 18:44:01 INFO remoting:103 - EJBCLIENT000017: Received server versio
n 2 and marshalling strategies [river]
2017-05-30 18:44:01 INFO remoting:219 - EJBCLIENT000013: Successful version han
dshake completed for receiver context EJBReceiverContext{clientContext=org.jboss
.ejb.client.EJBClientContext#15b3e5b, receiver=Remoting connection EJB receiver
[connection=Remoting connection <56467971>,channel=jboss.ejb,nodename=my-jms-master]} on channel Channel ID b9880cf2 (outbound) of Remoting connec
tion 71d15f18 to /10.0.0.247:7080
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail
s.
2017-05-30 18:44:02 INFO client:45 - JBoss EJB Client version 2.1.4.Final
2017-05-30 18:44:03 ERROR client:686 - AMQ214016: Failed to create netty connect
ion
java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:123)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622)
at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChann
el.java:209)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(Abs
tractNioChannel.java:207)
at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultCh
annelPipeline.java:1097)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(Abstract
ChannelHandlerContext.java:471)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChanne
lHandlerContext.java:456)
at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboun
dHandlerAdapter.java:47)
at io.netty.channel.CombinedChannelDuplexHandler.connect(CombinedChannel
DuplexHandler.java:167)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(Abstract
ChannelHandlerContext.java:471)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChanne
lHandlerContext.java:456)
at io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.ja
va:50)
at io.netty.channel.AbstractChannelHandlerContext.invokeConnect(Abstract
ChannelHandlerContext.java:471)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChanne
lHandlerContext.java:456)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChanne
lHandlerContext.java:438)
at io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipelin
e.java:908)
at io.netty.channel.AbstractChannel.connect(AbstractChannel.java:203)
at io.netty.bootstrap.Bootstrap$2.run(Bootstrap.java:166)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(Single
ThreadEventExecutor.java:358)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThread
EventExecutor.java:112)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "main" com.myApp.exceptions.ProcessorStart
upException: javax.jms.JMSException: Failed to create session factory
at com.myApp.SetUpBowcaster.main(Unknown Source)
Caused by: javax.jms.JMSException: Failed to create session factory
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.crea
teConnectionInternal(ActiveMQConnectionFactory.java:727)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.crea
teQueueConnection(ActiveMQConnectionFactory.java:284)
at com.myApp.applicationLayer.jms.BowcasterProcessorsH
andlersManager.setUpJmsConnection(Unknown Source)
at com.myApp.applicationLayer.jms.BowcasterProcessorsH
andlersManager.<init>(Unknown Source)
at com.myApp.applicationLayer.jms.BowcasterProcessorsH
andlersManager.getInstance(Unknown Source)
... 1 more
Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ1190
07: Cannot connect to server(s). Tried with all available servers.]
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.create
SessionFactory(ServerLocatorImpl.java:777)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.crea
teConnectionInternal(ActiveMQConnectionFactory.java:724)
... 5 more
2017-05-30 18:44:03 INFO remoting:482 - EJBCLIENT000016: Channel Channel ID b98
80cf2 (outbound) of Remoting connection 71d15f18 to /10.0.0.247:7080 can no long
er process messages
I solved by creating the connection in this way:
Map<String, Object> connectionParams = new HashMap<String, Object>();
connectionParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.HOST_PROP_NAME, nattedIp); // <-- PUT THE NATTED IP HERE!
connectionParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, nattedPort);
connectionParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME, "true");
connectionParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.HTTP_UPGRADE_ENDPOINT_PROP_NAME, "http-acceptor");
TransportConfiguration transportConfiguration = new org.apache.activemq.artemis.api.core.TransportConfiguration(JMS_NETTY_CONNECTOR_FACTORY_PROPERTY_NAME, connectionParams);
ActiveMQConnectionFactory jmsConnnectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.TOPIC_CF, transportConfiguration);
if (jmsConnnectionFactory != null) {
jmsConnnection = jmsConnnectionFactory.createConnection();
}
The address:port may need to be fully qualified. I fixed this by changing the following property in my code:
artemis.nodes=machine-artemis-01:port
to:
artemis.nodes=machine-artemis-01.place.company.com:port

How to grant permission to docker user write on /var/?

I'm trying to run confluence image on a docker container. This behavior is Intermittent - most of the time I can't run it, but at sometimes I can.
After downloading the image I run these commands in order put confluence online:
sudo chown -R daemon /data/confluence
sudo chown -R daemon /var/atlassian/application-data/confluence
docker run -v /data/your-confluence-home:/var/atlassian/application-data/confluence --name="confluence" -d -p 8090:8090 -p 8091:8091 atlassian/confluence-server
But then, I get this error on docker logs confluence
If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide
Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out
---------------------------------------------------------------------------
Using Java: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
2017-05-23 15:33:41,519 INFO [main] [atlassian.confluence.bootstrap.SynchronyProxyWatchdog] A Context element for ${confluence.context.path}/synchrony-proxy is found in /opt/atlassian/confluence/conf/server.xml. No further action is required
---------------------------------------------------------------------------
23-May-2017 15:33:42.013 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8090"]
23-May-2017 15:33:42.026 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
23-May-2017 15:33:42.028 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 381 ms
23-May-2017 15:33:42.033 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Tomcat-Standalone
23-May-2017 15:33:42.033 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.41
SLF4J: A number (1) of logging calls during the initialization phase have been intercepted and are
SLF4J: now being replayed. These are subject to the filtering rules of the underlying logging system.
SLF4J: See also http://www.slf4j.org/codes.html#replay
23-May-2017 15:33:43.517 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Spring WebApplicationInitializers detected on classpath: [com.atlassian.synchrony.proxy.SynchronyDispatcherServletInitializer#335dedfb]
23-May-2017 15:33:43.814 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Initializing Spring FrameworkServlet 'dispatcher'
23-May-2017 15:33:43.814 INFO [localhost-startStop-2] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'dispatcher': initialization started
23-May-2017 15:33:43.819 INFO [localhost-startStop-2] org.springframework.web.context.support.AnnotationConfigWebApplicationContext.prepareRefresh Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Tue May 23 15:33:43 UTC 2017]; root of context hierarchy
23-May-2017 15:33:43.864 INFO [localhost-startStop-2] org.springframework.web.context.support.AnnotationConfigWebApplicationContext.loadBeanDefinitions Registering annotated classes: [class com.atlassian.synchrony.proxy.websocket.WebSocketConfig,class com.atlassian.synchrony.proxy.web.SynchronyWebMvcConfig]
2017-05-23 15:33:44,007 INFO [localhost-startStop-1] [com.atlassian.confluence.lifecycle] contextInitialized Starting Confluence 6.2.0 [build 7111 based on commit hash 583f3f4010922d699723a091097524472954c767] - synchrony version 0.3.1-release-confluence_6.1-e20fb944
23-May-2017 15:33:44.371 INFO [localhost-startStop-2] org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler.initialize Initializing ExecutorService 'defaultSockJsTaskScheduler'
23-May-2017 15:33:44.670 INFO [localhost-startStop-2] org.springframework.web.socket.server.support.WebSocketHandlerMapping.registerHandler Mapped URL path [/sockjs/v1/**] onto handler of type [class org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler]
23-May-2017 15:33:44.854 INFO [localhost-startStop-2] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/healthcheck]}" onto public com.atlassian.synchrony.proxy.web.HealthCheckResult com.atlassian.synchrony.proxy.web.SynchronyProxyRestController.getSynchronyProxyInfo()
23-May-2017 15:33:44.855 INFO [localhost-startStop-2] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/reload],methods=[PUT]}" onto public org.springframework.http.ResponseEntity com.atlassian.synchrony.proxy.web.SynchronyProxyRestController.reloadConfiguration(com.atlassian.synchrony.proxy.web.SynchronyProxyConfigPayload)
23-May-2017 15:33:44.873 INFO [localhost-startStop-2] org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandler Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler]
23-May-2017 15:33:44.939 INFO [localhost-startStop-2] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache Looking for #ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet': startup date [Tue May 23 15:33:43 UTC 2017]; root of context hierarchy
23-May-2017 15:33:45.056 INFO [localhost-startStop-2] org.springframework.context.support.DefaultLifecycleProcessor.start Starting beans in phase 2147483647
23-May-2017 15:33:45.094 INFO [localhost-startStop-2] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'dispatcher': initialization completed in 1279 ms
2017-05-23 15:33:46,688 WARN [localhost-startStop-1] [com.atlassian.config.ApplicationConfig] setApplicationHome Application home does not exist. Creating directory: /var/atlassian/application-data/confluence/shared-home
2017-05-23 15:33:46,783 ERROR [localhost-startStop-1] [atlassian.config.bootstrap.DefaultAtlassianBootstrapManager] init Home is not configured properly:
com.atlassian.config.ConfigurationException: Couldn't save confluence.cfg.xml to /var/atlassian/application-data/confluence directory.
at com.atlassian.config.xml.AbstractDom4jXmlConfigurationPersister.saveDocument(AbstractDom4jXmlConfigurationPersister.java:86)
at com.atlassian.config.xml.DefaultDom4jXmlConfigurationPersister.save(DefaultDom4jXmlConfigurationPersister.java:24)
at com.atlassian.config.ApplicationConfig.save(ApplicationConfig.java:330)
at com.atlassian.confluence.setup.DefaultBootstrapManager.populateSynchronyConfiguration(DefaultBootstrapManager.java:298)
at com.atlassian.confluence.setup.DefaultBootstrapManager.afterConfigurationLoaded(DefaultBootstrapManager.java:509)
at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.init(DefaultAtlassianBootstrapManager.java:71)
at com.atlassian.config.util.BootstrapUtils.init(BootstrapUtils.java:36)
at com.atlassian.confluence.setup.ConfluenceConfigurationListener.initialiseBootstrapContext(ConfluenceConfigurationListener.java:127)
at com.atlassian.confluence.setup.ConfluenceConfigurationListener.contextInitialized(ConfluenceConfigurationListener.java:60)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createTempFile(File.java:2024)
at com.atlassian.config.xml.AbstractDom4jXmlConfigurationPersister.saveDocumentAtomically(AbstractDom4jXmlConfigurationPersister.java:92)
at com.atlassian.config.xml.AbstractDom4jXmlConfigurationPersister.saveDocument(AbstractDom4jXmlConfigurationPersister.java:82)
... 17 more
What am I doing wrong?
Have you tried via named volume (if using a docker version >= 1.9)?
$ sudo docker volume create --name confluenceVolume
$ sudo docker run -v confluenceVolume:/var/atlassian/application-data/confluence --name="confluence" -d -p 8090:8090 -p 8091:8091 atlassian/confluence-server
Add ENTRYPOINT script and use it. Example - https://github.com/AfsmNGhr/dockemacs/blob/master/Dockerfile#L34. See also - http://www.johnzaccone.io/entrypoint-vs-cmd-back-to-basics/.

unable to figure jboss error

can someone figure out whats the error in jboss. when i enter localhost:8080 in url it says INVALID REQUEST. PLEASE CHECK URL.
I am using jboss 5.0.1
JBOSS_HOME: D:\Jboss\jboss-5.0.1.GA
JAVA: C:\Program Files\Java\jdk1.6.0_13\bin\java
JAVA_OPTS: -Dfile.encoding=UTF-8 -Dprogram.name=run.bat -server -Xms512m -Xmx1024m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
CLASSPATH: D:\Jboss\jboss-5.0.1.GA\bin\run.jar
===============================================================================
20:46:16,640 INFO [ServerImpl] Starting JBoss (Microcontainer)...
20:46:16,640 INFO [ServerImpl] Release ID: JBoss [Morpheus] 5.0.1.GA (build: SVNTag=JBoss_5_0_1_GA date=200902231221)
20:46:16,640 INFO [ServerImpl] Bootstrap URL: null
20:46:16,656 INFO [ServerImpl] Home Dir: D:\Jboss\jboss-5.0.1.GA
20:46:16,656 INFO [ServerImpl] Home URL: file:/D:/Jboss/jboss-5.0.1.GA/
20:46:16,656 INFO [ServerImpl] Library URL: file:/D:/Jboss/jboss-5.0.1.GA/lib/
20:46:16,656 INFO [ServerImpl] Patch URL: null
20:46:16,656 INFO [ServerImpl] Common Base URL: file:/D:/Jboss/jboss-5.0.1.GA/common/
20:46:16,656 INFO [ServerImpl] Common Library URL: file:/D:/Jboss/jboss-5.0.1.GA/common/lib/
20:46:16,656 INFO [ServerImpl] Server Name: default
20:46:16,656 INFO [ServerImpl] Server Base Dir: D:\Jboss\jboss-5.0.1.GA\server
20:46:16,671 INFO [ServerImpl] Server Base URL: file:/D:/Jboss/jboss-5.0.1.GA/server/
20:46:16,671 INFO [ServerImpl] Server Config URL: file:/D:/Jboss/jboss-5.0.1.GA/server/default/conf/
20:46:16,671 INFO [ServerImpl] Server Home Dir: D:\Jboss\jboss-5.0.1.GA\server\default
20:46:16,671 INFO [ServerImpl] Server Home URL: file:/D:/Jboss/jboss-5.0.1.GA/server/default/
20:46:16,671 INFO [ServerImpl] Server Data Dir: D:\Jboss\jboss-5.0.1.GA\server\default\data
20:46:16,671 INFO [ServerImpl] Server Library URL: file:/D:/Jboss/jboss-5.0.1.GA/server/default/lib/
20:46:16,671 INFO [ServerImpl] Server Log Dir: D:\Jboss\jboss-5.0.1.GA\server\default\log
20:46:16,671 INFO [ServerImpl] Server Native Dir: D:\Jboss\jboss-5.0.1.GA\server\default\tmp\native
20:46:16,687 INFO [ServerImpl] Server Temp Dir: D:\Jboss\jboss-5.0.1.GA\server\default\tmp
20:46:16,687 INFO [ServerImpl] Server Temp Deploy Dir: D:\Jboss\jboss-5.0.1.GA\server\default\tmp\deploy
20:46:17,296 INFO [ServerImpl] Starting Microcontainer, bootstrapURL=file:/D:/Jboss/jboss-5.0.1.GA/server/default/conf/bootstrap.xml
20:46:17,859 INFO [VFSCacheFactory] Initializing VFSCache [org.jboss.virtual.plugins.cache.CombinedVFSCache]
20:46:17,859 INFO [VFSCacheFactory] Using VFSCache [CombinedVFSCache[real-cache: null]]
20:46:18,140 INFO [CopyMechanism] VFS temp dir: D:\Jboss\jboss-5.0.1.GA\server\default\tmp
20:46:18,156 INFO [ZipEntryContext] VFS force nested jars copy-mode is enabled.
20:46:20,218 INFO [ServerInfo] Java version: 1.6.0_13,Sun Microsystems Inc.
20:46:20,234 INFO [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
20:46:20,234 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 11.3-b02,Sun Microsystems Inc.
20:46:20,234 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
20:46:20,265 INFO [JMXKernel] Legacy JMX core initialized
20:46:22,593 INFO [ProfileServiceImpl] Loading profile: default from: org.jboss.system.server.profileservice.repository.SerializableDeploymentRepository#126c5a5(root=D:\Jboss\jboss-5.0.1.GA\server, key=org.jboss.profileservice.spi.Pro
fileKey#143b82c3[domain=default,server=default,name=default])
20:46:22,593 INFO [ProfileImpl] Using repository:org.jboss.system.server.profileservice.repository.SerializableDeploymentRepository#126c5a5(root=D:\Jboss\jboss-5.0.1.GA\server, key=org.jboss.profileservice.spi.ProfileKey#143b82c3[doma
in=default,server=default,name=default])
20:46:22,593 INFO [ProfileServiceImpl] Loaded profile: ProfileImpl#1e779a7{key=org.jboss.profileservice.spi.ProfileKey#143b82c3[domain=default,server=default,name=default]}
20:46:24,421 INFO [WebService] Using RMI server codebase: http://127.0.0.1:9283/
20:46:30,656 INFO [NativeServerConfig] JBoss Web Services - Stack Native Core
20:46:30,671 INFO [NativeServerConfig] 3.0.5.GA
20:46:42,218 INFO [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:2290/jmxconnector
20:46:42,375 INFO [MailService] Mail Service bound to java:/Mail
20:46:44,015 WARN [JBossASSecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installat
ion default. Please see the JBoss Messaging user guide for instructions on how to do this.
20:46:44,031 WARN [AnnotationCreator] No ClassLoader provided, using TCCL: org.jboss.managed.api.annotation.ManagementComponent
20:46:44,203 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
20:46:44,203 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
20:46:44,656 INFO [TransactionManagerService] Initializing recovery manager
20:46:44,843 INFO [TransactionManagerService] Recovery manager configured
20:46:44,843 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
20:46:44,875 INFO [TransactionManagerService] Starting transaction recovery manager
20:46:45,453 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
20:46:45,453 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8218
20:46:45,453 INFO [StandardService] Starting service jboss.web
20:46:45,453 INFO [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.2.GA
20:46:45,531 INFO [Catalina] Server startup in 146 ms
20:46:45,562 INFO [TomcatDeployment] deploy, ctxPath=/invoker
20:46:46,156 INFO [TomcatDeployment] deploy, ctxPath=/jbossws
20:46:46,203 INFO [TomcatDeployment] deploy, ctxPath=/web-console
20:46:46,265 INFO [[/web-console]] SystemFolder: Failed to init plugin, Resource not found: SystemFolder.bsh
20:46:46,296 INFO [[/web-console]] J2EEFolder: Failed to init plugin, Resource not found: J2EEFolder.bsh
20:46:46,421 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
20:46:46,531 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
20:46:46,578 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/jms-ra.rar/META-INF/ra.xml
20:46:46,609 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/mail-ra.rar/META-INF/ra.xml
20:46:46,640 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
20:46:46,796 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
20:46:46,843 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
20:46:46,843 INFO [RAMJobStore] RAMJobStore initialized.
20:46:46,843 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
20:46:46,843 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
20:46:46,843 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
20:46:47,531 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
20:46:48,062 INFO [ServerPeer] JBoss Messaging 1.4.1.GA server [0] started
20:46:48,296 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4657 has leasing enabled, lease period 10000 milliseconds
20:46:48,296 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory#3dc250 started
20:46:48,359 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4657 has leasing enabled, lease period 10000 milliseconds
20:46:48,359 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory#188ef97 started
20:46:48,406 INFO [QueueService] Queue[/queue/A] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,406 INFO [QueueService] Queue[/queue/ex] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,406 INFO [QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,406 INFO [QueueService] Queue[/queue/B] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,406 INFO [QueueService] Queue[/queue/C] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,421 WARN [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory wil
l *not* support failover
20:46:48,421 WARN [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factor
y will *not* support load balancing
20:46:48,421 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4657 has leasing enabled, lease period 10000 milliseconds
20:46:48,421 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory#2de670 started
20:46:48,421 INFO [QueueService] Queue[/queue/D] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,421 INFO [QueueService] Queue[/queue/MailQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,421 INFO [TopicService] Topic[/topic/testDurableTopic] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,421 INFO [QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,437 INFO [TopicService] Topic[/topic/securedTopic] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,437 INFO [QueueService] Queue[/queue/testQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,437 INFO [TopicService] Topic[/topic/testTopic] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,640 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
20:46:48,703 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=PostgresDSDYPK' to JNDI name 'java:PostgresDSDYPK'
20:46:48,734 INFO [TomcatDeployment] deploy, ctxPath=/
20:46:50,312 INFO [TomcatDeployment] deploy, ctxPath=/ap
20:46:50,406 WARN [JAXWSDeployerHookPreJSE] Cannot load servlet class: org.jboss.jmx.adaptor.html.HtmlAdaptorServlet
20:46:50,406 WARN [JAXWSDeployerHookPreJSE] Cannot load servlet class: org.jboss.jmx.adaptor.html.ClusteredConsoleServlet
20:46:50,421 INFO [TomcatDeployment] deploy, ctxPath=/jmx-conso1e
20:46:50,500 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
20:46:50,531 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8218
20:46:50,546 INFO [ServerImpl] JBoss (Microcontainer) [5.0.1.GA (build: SVNTag=JBoss_5_0_1_GA date=200902231221)] Started in 33s:859ms
You will also have to specify the binding address for the jboss server. For jboss5.x, the command will be like
Jboss\jboss-5.0.1.GA\bin\run.jar -b0.0.0.0
Check your port number under /deploy/jbossweb.sar/server.xml, I think the problem is right there.
It should be like this ==>
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
Check the port number!

Java SecurityManager with SpringSecurity

I try join Java Security Manager to project with SpringSecurity (SS). I have the goal: my project works with SS and has dataSource (db2 database) as authentication-manager. I added ScriptManager(ScriptEngine) to project. Now I tries to setup security of project, what deny untrusted code. I use NetBeans and in properties of Tomcat (6.0.20) setup "Use Security Manager". Next, I edited {catalina.base}/conf/catalina.police. I added next "grants":
grant codeBase "file:${catalina.base}/webapps/myapp/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${catalina.base}/webapps/myapp/WEB-INF/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${catalina.base}/webapps/myapp/WEB-INF/lib/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${catalina.base}/webapps/myapp/WEB-INF/classes/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${catalina.base}/work/Catalina/localhost/myapp/" {
permission java.lang.RuntimePermission "defineClassInPackage.org.apache.jasper.runtim e";
permission java.lang.RuntimePermission "accessDeclaredMembers";
};
grant codeBase "file:${catalina.base}/webapps/myapp/-" {
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.lang.reflect.ReflectPermission "accessDeclaredMembers";
permission java.io.FilePermission "${catalina.home}${file.separator}myapp${file.sepa rator}*", "read";
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "*";
permission java.util.PropertyPermission "*", "read";
};
And now problem. When I run my code under debuger I get next error:
07.12.2010 2:06:02 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
07.12.2010 2:06:04 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.http.UserDeta ilsServiceInjectionBeanPostProcessor#0': Initialization of bean failed; nested exception is java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
.................................................
and tomcat out:
Using CATALINA_BASE: /home/user/.netbeans/6.8/apache-tomcat-6.0.20_base
Using CATALINA_HOME: /usr/local/apache-tomcat-6.0.20
Using CATALINA_TMPDIR: /home/user/.netbeans/6.8/apache-tomcat-6.0.20_base/temp
Using JRE_HOME: /usr/lib/jvm/java
Using Security Manager
Listening for transport dt_socket at address: 11555
07.12.2010 2:04:43 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/lib/i386/server:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/lib/i386:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/../lib/i386:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/lib/i386/client:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/lib/i386:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/../lib/i386:/usr/lib/mpi/gcc/openmpi/lib:/usr/java/packages/lib/i386:/lib:/usr/lib
07.12.2010 2:04:43 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8084
07.12.2010 2:04:43 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-9443
07.12.2010 2:04:43 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1536 ms
07.12.2010 2:04:43 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
07.12.2010 2:04:43 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
07.12.2010 2:04:45 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/deniz/NetBeansProjects/opensee/build/web/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
07.12.2010 2:04:45 org.apache.juli.ClassLoaderLogManager readConfiguration
WARNING: Reading /home/deniz/NetBeansProjects/opensee/build/web/WEB-INF/classes/logging.properties is not permitted. See "per context logging" in the default catalina.policy file.
07.12.2010 2:04:45 org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
07.12.2010 2:04:47 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/opensee'
07.12.2010 2:04:47 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
07.12.2010 2:04:47 org.apache.catalina.core.StandardContext start
SEVERE: Context [/opensee] startup failed due to previous errors
07.12.2010 2:04:47 com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactor y(FactoryFinder.java:804)
at javax.faces.FactoryFinder.getFactory(FactoryFinder .java:306)
at com.sun.faces.config.InitFacesContext.getApplicati on(InitFacesContext.java:104)
at com.sun.faces.config.ConfigureListener.contextDest royed(ConfigureListener.java:309)
at org.apache.catalina.core.StandardContext.listenerS top(StandardContext.java:3973)
at org.apache.catalina.core.StandardContext.stop(Stan dardContext.java:4577)
.................
Also, when I insert this grant:
grant {
permission java.security.AllPermission;
};
all ok.
OS: openSUSE 11.1
OpenJDK 1.6.0.0-b11
For setup used this tutorial: http://www.mikeski.net/site/node/18
Thanks all...

Resources