Hi I am trying to reach my repository via JNDI.
I recieve the following message when i try to connect:
"The repository home C:\apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\bin\myrepo > appears to be in use since the file named .lock is already locked by the current process."
This code is runing on a web application, deployed on the same Tomcat.
InitialContext context = new InitialContext();
Context environment = (Context) context.lookup("java:comp/env");
Repository repository = (Repository) environment.lookup("jcr/repository");
Tomcat is locking "myrepo" when it starts and wont release it until I shuts it down.
Why is this happening?
Im running apache-tomcat-7.0.53-windows-x64 on Windows 7, using jackrabbit-webapp-2.6.5.war.
Edit May 10:
I have now tried to edit server.xml ann context.xml for my tomcat.
server.xml:
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
<Resource configFilePath="C:\apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\bin\myrepo\repository.xml"
factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
name="jcr/globalRepository" repHomeDir="C:\apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\bin\myrepo"
type="javax.jcr.Repository"
auth="Container" />
</GlobalNamingResources>
context.xml
<ResourceLink name="jcr/repository"
global="jcr/globalRepository"
type="javax.jcr.Repository"/>
The error is still the same.
There are a .lock file inside the repository folder. delete that file.
Related
I'm working on Spring boot Application along with liquibase version 3.5.3, in which I need to configure two different JNDI data source for liquibase task and application execution.
I have created two different JNDI data source in tomcat server.xml file
<Resource name="JDBC/DSAdmin"
global="jdbc/DSAdmin"
auth="Container"
factory="com.zaxxer.hikari.HikariJNDIFactory"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
jdbcUrl="jdbc:mysql://localhost:3306/dbname"
username="admin"
password="admin"
minimumIdle="5" maximumPoolSize="50" connectionTimeout="300000" maxLifetime="1800000" />
and
<Resource name="jdbc/DS"
global="jdbc/DS"
auth="Container"
factory="com.zaxxer.hikari.HikariJNDIFactory"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
jdbcUrl="jdbc:mysql://localhost:3306/database"
username="root"
password="root"
minimumIdle="5" maximumPoolSize="50" connectionTimeout="300000" maxLifetime="1800000" />
I need to run the liquibase task using the jdbc/DSAdmin connection pool and application using the jdbc/DS connection pool.
But liquibase version 3.5.3 doesn't provide any property to specify data source by using tomcat server resource.
In application.properties file, I have configured spring.datasource.jndi-name = java:comp/env/jdbc/DSAdmin
Similarly I want to configure liquibase.datasoure=java:comp/env/jdbc/DS
this is my context.xml file
<ResourceLink name="jdbc/DS"
global="jdbc/DS"
auth="Container"
type="javax.sql.DataSource" />
<ResourceLink name="jdbc/DSAdmin"
global="jdbc/DSAdmin"
auth="Container"
type="javax.sql.DataSource" />
I am trying to setup Keycloak with Tomcat 8.
I followed the instruction carefully. I downloaded the Client Adapter for Tomcat8 and copied all the jar into $CATALINA_HOME/lib directory. I modified my web.xml login-config to use KEYCLOAK. Yet when I started Tomcat I kept getting Severe Error Unknown Authenticator??
Anywhere I googled everyone said you have to install the Client Adapter but.. in my case IT IS ALREADY THERE!!! HELP!!
I think you forgot to create a META-INF directory beside the WEB-INF and put a file named context.xml into it:
The contents of this file has to be
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>
This is not needed if you deploy the war into WildFly. I had the same problem when I tried to transfer a well working webApp from WildFly to Tomcat.
I am TomEE administrator and i wanted my application team to package resource configuration inside of their application, i.e. /META-INF/context.xml. Apparently this not working with TomEE, i know its working for my other Tomcat applications.
While doing so the i am getting "Unable to find the DataSource" exception.
I know some people recommended to put resource config in ../conf/tomee.xml. But i want application team to put inside war file so we can enable automation and all AD team has to do is deploy war file.
add deployXML and copyXML attribute to Host element in server.xml and set their value to true as followed
<Host appBase="webapps" autoDeploy="true" copyXML="true" deployXML="true" name="localhost" unpackWARs="true" xmlBase="conf/Catalina/localhost">
Wishing to have a Worklight Console Authentication I followed the infocenter instructions from this link at infocenter.It seems to be working at the first glance as entering the console it prompts the login form.
Going to the console URL at http://192.168.168.154:9080/finance/console/#catalog it brings the login page right away. So far so good.
After entering the right username/password (both defined at worklight.properties) the login page redirects to the Worklight console at port 10080 and fails to load the page
Unable to connect
Firefox can't establish a connection to the server at 192.168.168.154:10080.
As you can read it tries to connect to http://192.168.168.154:10080/finance/console. It should not happen I guess, as port 10080 was not configured.
I have no idea why it is redirecting to this port. I searched inside the config files for 10080 and could not find any reference to it. I think somehow WL is getting this 10080 as a default as it is the port used for development.
Here is the files snippets I am using to enable Login Console:
worklight.properties:
#publicWorkLightHostname=localhost
# http or https
#publicWorkLightProtocol=http
# For default port leave empty
#publicWorkLightPort=10080 <-- it is commented out
console.username=finance
console.password=finance
authenticationConfig.xml
<staticResources>
<resource id="worklightConsole" securityTest="WorklightConsole">
<urlPatterns>/console*</urlPatterns>
</resource>
....
</staticResources>
<securityTests>
<customSecurityTest name="WorklightConsole">
<test realm="WorklightConsole" isInternalUserID="true"/>
</customSecurityTest>
...
</securityTests>
server.xml
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" >
<tcpOptions soReuseAddr="true"/>
</httpEndpoint>
<!-- Declare the JNDI properties for the IBM Worklight Console. -->
<jndiEntry jndiName="worklight/publicWorkLightProtocol" value='"http"'/>
<jndiEntry jndiName="worklight/publicWorkLightPort" value='"9080"'/>
<jndiEntry jndiName="worklight/serverSessionTimeout" value='"10"'/>
Any idea on how to solve this port mismatch issue ? Env is WL 6.0 on Liberty
P.S: Later on we plan to user LDAP instead. For now, having the username/passaword in the properties would suffice.
In worklight.properties, uncomment the #publicWorkLightPort=10080 property and change it to 9080.
worklight.properties is part of the Worklight project's .war file that is deployed into the application server; the application server may have its own port number set in server.xml, but the .war (project) has some specific properties of its own.
During my testing I encountered the same issue, but once uncommenting and changing the port value in worklight.properties, the re-direct then worked properly after logging-in.
I need to form a infinispan cluster in distributed mode. This cache is used for storing session data. Currently I am using tomcatInfinispanSessionManager developed by Manik from Jboss team.
I have created the infinispan xml in distributed mode and using two tomcats for testing. Using apache as a load balancer. Each machine has its own copy of infinispan cache entry. When any of the tomcat is shut down the session is retrieved from other infinispan cache.
My question is: how to make this cache entry into an infinispan server (either using hotrod/memcached) that is running on a separate machine?
If you add a remote cache loader to the cache configuration you have, it'll back up the data in a remote Hot Rod server, assuming you configure the IP:Port address of the Hot Rod server(s) correctly.
However, if you're trying to cluster your session data, I'd highly recommend you download JBoss EAP 6.1, which comes with Infinispan-based cluster-ready session data storage out of the box. The session cache can still be configured with a remote cache loader too, but the configuration will be slightly different since it uses JBoss EAP configuration format.
I am using ispn 5.1 version and started the server in hotrod mode. My cache config xml is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.3 http://www.infinispan.org/schemas/infinispan-config-5.3.xsd
urn:infinispan:config:remote:5.3 http://www.infinispan.org/schemas/infinispan-cachestore-remote-config-5.3.xsd"
xmlns="urn:infinispan:config:5.3" xmlns:remote="urn:infinispan:config:remote:5.3">
<global>
<transport clusterName="tomcatSession">
<properties>
<property name="configurationFile"
value="E:/Software/apache-tomcat-7.0.34/conf/jgroups.xml">
</property>
</properties>
</transport>
<globalJmxStatistics enabled="true" />
</global>
<namedCache name="tc_session_ispn-sess-mgr">
<clustering mode="distribution">
<l1 enabled="true" lifespan="600000" />
</clustering>
<loaders>
<remoteStore xmlns="urn:infinispan:config:remote:5.3"
fetchPersistentState="false" ignoreModifications="false"
purgeOnStartup="false" remoteCache="myCache" rawValues="true">
<servers>
<server host="10.145.4.172" port="11222" />
</servers>
<connectionPool maxActive="10" exhaustedAction="CREATE_NEW" />
<async enabled="true" />
</remoteStore>
</loaders>
</namedCache>
</infinispan>
While using this cache config xml I am gettong the following exception
Exception in thread "main" org.infinispan.config.ConfigurationException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[39,104]
Message: Unexpected element '{urn:infinispan:config:remote:5.3}remoteStore' encountered
at org.infinispan.configuration.parsing.Parser.parse(Parser.java:168)
at org.infinispan.configuration.parsing.Parser.parse(Parser.java:130)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:368)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:340)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:327)
Kindly correct me if I am wrong and suggest how to proceed further?