Tomcat server is not starting - security

I am using jdbc in form based authentication but when i add realm tag with connection properties in server.xml file, tomcat is not starting:
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:#localhost:1521:XE"
connectionName="system"
connectionPassword="system"
userTable="users" userNameCol="username" userCredCol="password"
userRoleTable="user_roles" roleNameCol="rolename"/>

Related

AEM 6.5 Oracle DB NoClassDefFoundError

from my AEM 6.5 instance currently I connect correctly to an oracle db using tcp:
jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=my-oracle-db)(PORT=1531)))(CONNECT_DATA=(SERVICE_NAME=MY_SRV)))
But when I try to establish a secure connection like this:
jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCPS)(HOST=my-oracle-secure-db)(PORT=1541)))(CONNECT_DATA=(SERVICE_NAME=MY_SRV)))
I get a oraclepki.jar must be in the classpath: java.lang.NoClassDefFoundError: oracle/security/pki/OracleWallet. The wallet is configured correctly and I tried to add the following dependency in my project, without any result:
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>oraclepki</artifactId>
<version>19.3.0.0</version>
</dependency>
...
<embedded>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>oraclepki</artifactId>
<target>/apps/myproject/install</target>
</embedded>
...
<filter root="/apps/myproject/install/oraclepki-19.3.0.0.jar"/>
Do you have any idea of the cause?
Regards

jboss fuse 6.2.1 mq in fabric

i have jboss fuse 6.2.1 on linux server in a fabric mode with two child container. I created mq with this command
fabric:mq-create --group mur --assign-container risng1,risng2 --port tcp=61617 mur-broker
MQ profile mq-broker-mur.mur-broker ready
but i expect transport protocol will be configured with static port 61617 but it is dynamic.
In fuse 6.1 i modifed base template broker.xml
<transportConnector name="openwire" uri="tcp://0.0.0.0:${bindPort}"/>
bind port is configured in properties in profile. In fuse 6.2 does not work. My question is how to configured static port in fabric mode on jms broker?
I found closed issue https://issues.jboss.org/browse/FABRIC-1237
solved,
you can use custom template in your profile
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- Allows us to use system properties and fabric as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
<bean class="io.fabric8.mq.fabric.ConfigurationProperties"/>
</property>
</bean>
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="${broker-name}" dataDirectory="${data}" start="false" restartAllowed="false">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" producerFlowControl="true">
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000"/>
</pendingMessageLimitStrategy>
</policyEntry>
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<persistenceAdapter>
<kahaDB directory="${data}/kahadb"/>
</persistenceAdapter>
<plugins>
<jaasAuthenticationPlugin configuration="karaf" />
</plugins>
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="70"/>
</memoryUsage>
<storeUsage>
<storeUsage limit="500 mb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="500 mb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<transportConnectors>
<transportConnector name="openwire" uri="tcp://${bindAddress}:61617"/>
</transportConnectors>
</broker>
</beans>
and the edit properties
group = mur
broker-name = mur-broker
connectors=openwire
kind = MasterSlave
data = ${runtime.data}mur-broker
config=profile\:broker-mur.xml
config.checksum=${checksum:profile\:broker-mur.xml}
standby.pool=default
bindAddress=0.0.0.0
bindPort=61617

Configure Security Manager on Tomcat7

Trying to configure Security Manager for Tomcat 7. We are running Java 1.8.0_51 on a 64 bit Windows 2008 server and run Tomcat as a service. I've added the following lines as Java Options:
-Djava.security.manager
-Djava.security.policy=D:\Program Files\Apache Software Foundation\Tomcat7.0\conf\catalina.policy
The security policy file is the default file and has not been modified. After adding the lines I can no longer start Tomcat. I get the following error messages:
2015-10-07 08:58:31 Commons Daemon procrun stderr initialized properties: reading security properties file: C:\Program Files\Java\jre1.8.0_51\lib\security\java.security jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/D:/Program%20Files/Apache%20Software%20Foundation/Tomcat7.0/bin/tomcat-juli.jar <no signer certificates>) sun.misc.Launcher$AppClassLoader#c387f44 <no principals> java.security.Permissions#28d93b30 ( ("java.lang.RuntimePermission" "exitVM") ("java.io.FilePermission" "\D:\Program Files\Apache Software Foundation\Tomcat7.0\bin\tomcat-juli.jar" "read") ) scl: policy: reading file:/D:/Program%20Files/Apache%20Software%20Foundation/Tomcat7.0/conf/catalina.policy [Policy Parser]: sun.security.util.PropertyExpander$ExpandException: unable to expand property catalina.home [Policy Parser]: sun.security.util.PropertyExpander$ExpandException: unable to expand property catalina.base
I also see errors like the following:
java.lang.IllegalArgumentException: null KeyStore name
If I remove the new config lines all is well.
Any ideas?

Hawtio unable to connect to Jolokia if Jolokia security is enabled

Very new to Hawtio and Jolokia. I am NOT using JBOSS or any other RedHat product, only Tomcat. I downloaded Hawtio-default.war (ver. 1.4.21) and Jolokia.war (ver. 1.2.2). I have two Tomcat (7.0.39) instances on my local machine (localhost), running on port 18080 and 38080 respectively.
The issue: If I didn't enable the security for Jolokia, I was OK to connect from Hawtio (port 18080) to Jolokia (port 38080) without any problem. However, if I enabled the security for Jolokia, I was NOT able to connect and always got below error (tried in both FF and Chrome):
This is the details of I have done:
1. Deployed Hawtio.war to Tomcat running on port 18080.
2. deployed Jolokia.war to Tomcat running on port 38080.
3. Without enabling security for Jolokia, I was able to connect from Hawtio (port 18080), without proxy, to Jolokia (port 38080). Success.
4. Then, I tried to enable security for Jolokia by uncommenting the section in its web.xml to make it look like this:
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>UserDatabase</realm-name>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>Jolokia-Agent Access</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Jolokia</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>Jolokia</role-name>
</security-role>
and in tomcat/conf/user-tomat.xml file, I added:
<role rolename="Jolokia"/>
<user username="admin" password="hawtorwhat" roles="Jolokia"/>
Add username/password and role to tomcat-users.xml file as:
restarted both Tomcat instances.
Tried to goto Jolokia directly http://localhost:38080/jolokia, it prompted me for username and password. After I typed in admin and hawtorwhat, I was shown below message in my browser. So it looked like OK to directly remote connect to a security-enabled Jolokia.
launched http://localhost:18080/hawtio, clicked on "Connect" tab, provided same info plus username and password for localhost port 38080 (without proxy), un-success. the error was always the same (different error for different browser, strange, no previous hawtio plug-in for Chrome):
In FireFox:
Cannot Connect: [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost:18080/hawtio/app/app.js?6f7be3a9a9f2ffe8 :: .send :: line 8" data: no]
In Chrome:
Cannot Connect: NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:38080/jolokia-war-1.2.2/?maxDepth=2&maxCollectionSize=500&ignoreErrors=true&canonicalNaming=false'.
I also tried check 'use proxy', it didn't work regardless with or without security enabled. Error message was as:
java.net.UnknownHostException: http
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
java.net.Socket.connect(Socket.java:579)
java.net.Socket.connect(Socket.java:528)
java.net.Socket.<init>(Socket.java:425)
java.net.Socket.<init>(Socket.java:208)
io.hawt.web.OpenShiftProtocolSocketFactory.createSocket(OpenShiftProtocolSocketFactory.java:36)
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
io.hawt.web.ProxyServlet.executeProxyRequest(ProxyServlet.java:418)
io.hawt.web.ProxyServlet.doPost(ProxyServlet.java:273)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
io.hawt.web.RedirectFilter.process(RedirectFilter.java:66)
io.hawt.web.RedirectFilter.doFilter(RedirectFilter.java:38)
My IE (ver. 9) doesn't seem to support html5, leave it out for now...
I read docs and others internet posts for both Hawio and Jolokia, not sure what I missed. Based on #3 and #7 above, Jolokia seemed to be running fine. What else should I do? Is any config or additional files that I need to add anywhere? Please help. Also, how am i going to debug this?
Thank you,
---misterxy

Deploying JSF Application with Virtual host in TomcatServer

I am using Mojarra 2.0.4 implementation of JSF with Tomcat server for one of my application, now i came to a problem during its deployment. I had added a virtual host to the Tomcat server.xml as follows,
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"/>
<Host name="www.edgeutil308.com" appBase="webapps/EdgeUtil"
unpackWARs="true" autoDeploy="true">
<Alias>edgeutil308.com</Alias>
<Context path="" docBase="."/>
</Host>
The problem which i am facing is that my mojarra implementation initializes twice as like below\
INFO: Initializing Mojarra 2.0.4 (FCS b06) for context ''
INFO: Initializing Mojarra 2.0.4 (FCS b06) for context '/EdgeUtil'
and also i couldnot get the application run without using the project name as its context path like this
www.edgeutil308.com/EdgeUtil
Please help me to solve this issue.
Looks like some mismatch with your appBase definitions. The appbase for the edgeutil308 host is inside the appbase for the localhost host.

Resources