Ok, I'm struggling to get Archiva 1.4 in standalone mode to use an existing Postgres db. Can anyone help me configure it?
Working with Olivier, this was my final, working db config:
<New id="users" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/users</Arg>
<Arg>
<New class="org.apache.tomcat.jdbc.pool.DataSource">
<Set name="driverClassName">org.postgresql.Driver</Set>
<Set name="url">jdbc:postgresql://<server>/Archiva</Set>
<Set name="name">ArchivaApp</Set>
<Set name="username">...</Set>
<Set name="password">...</Set>
<!-- depends on your concurrent users numbers -->
<Set name="maxWait">10000</Set>
<Set name="removeAbandonedTimeout">10000</Set>
<Set name="maxActive">30</Set>
<Set name="initialSize">15</Set>
<Set name="removeAbandoned">true</Set>
<Set name="logAbandoned">true</Set>
<Set name="testOnBorrow">true</Set>
<!-- very rigourous sql query validation -->
<Set name="validationQuery">select 1</Set>
</New>
</Arg>
</New>
It was important to set the testOnBorrow parameter; some of the others don't matter.
Depends if you are using standalone or in a servlet container
1)Standalone have a look here
http://archiva.apache.org/docs/1.4-M4-SNAPSHOT/adminguide/standalone.html
replace com.mysql.jdbc.Driver with
your jdbc driver
and replace url jdbc:mysql://localhost/archiva
put your jdbc driver jar to lib directory
2) servlet container (it depends :-) )
for Apache Tomcat see
http://archiva.apache.org/docs/1.4-M4-SNAPSHOT/adminguide/webapp.html
put your jdbc driver jar to lib directory
change values
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:/path/to/database/users;create=true"
I have updated documentation here database section
Related
I am new to solr. I want to load synonyms or stopwords from DB instead of txt file to solr at analyzing phase. How can I acheive it in solr 6.
I tried porting Solr-JDBC(https://github.com/shopping24/solr-jdbc), and I configured web.xml with code below:
<resource-ref>
<description>my datasource</description>
<res-ref-name>jdbc/dsTest</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
and solr-jetty-context.xml with:
<New id="dsTest" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/dsTest</Arg>
<Arg>
<New class="org.postgresql.ds.PGSimpleDataSource">
<Set name="User">username</Set>
<Set name="Password">password</Set>
<Set name="DatabaseName">DBName</Set>
<Set name="ServerName">localhost</Set>
<Set name="PortNumber">5432</Set>
</New>
</Arg>
</New>
But I encountered the following error when I was trying to start SolrCloud.
Error: did not see solr at http://localhost:8983/solr come online
within 30
Also, the needed libraries are added to the correct folder.
Honestly I think this solution is a mess, I strongly suggest to export your synonyms and stopwords in a text file and save them overwriting your old configuration files.
After that, maybe you already know, you have to reload the core/collection configuration and, depending from your analyzer chain, reindex all the documents involved.
On the other hand, if you really want follow this way, looking at your question I can give you the following suggestion, you have to double check:
jdbc driver (check you copied postgresql-xxxxx.jdbc.jar to $JETTY_HOME/lib/ext)
network (check that postgres instance is up and listening on localhost:5432)
account (check username and password are correct)
db name (check the such db is present and the user has the permission)
Yes, it is fixed, I have downloaded jetty-jndi.jar but forgot to add it in lib folder.
So do not forget add postgresql-xxxx, jetty-jndi and jetty-plus to server/lib
Trying to increase the number of threads in embedded jetty running in karaf .Im changing the jetty.xml with the following properties as described in the POST .
<Configure class="org.eclipse.jetty.server.Server">
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">1000</Set>
</New>
</Arg>
</Call>
</Configure>
And also having org.ops4j.pax.web.cfg file in karaf ,with below properties :
org.ops4j.pax.web.config.file=${karaf.home}/jetty.xml
so to refer the external configurations (Jetty). But Im not able to increase/decrease the default thread size of the server . So What am I missing ?
With the latest Pax-Web 4.2.0 it's possible to configure those settings via configuration admin. The following three new settings can be used:
org.ops4j.pax.web.server.maxThreads
org.ops4j.pax.web.server.minThreads
org.ops4j.pax.web.server.idleTimeout
I am new to SOLR and MONGODB.
I am trying to index data from mongodb into SOLR using DataImportHandler but I could not find the exact steps that I need to follow.
Could you please help me in getting the exact steps to index MongoDB into Solr using DataImportHandler?
SolrVersion - solr-4.6.0
MongoDB version- 2.2.7
Late to answer, however thought people might find it useful.
Below are the steps for importing data from mongodb to Solr 4.7.0 using DataImportHandler.
Step 1:
Assume that your Mongodb has following database and collection
Database Name: Test
Collection Name: sample
The sample collection has following documents
db.sample.find()
{ "_id" : ObjectId("54c0c6666ee638a21198793b"), "Name" : "Rahul", "EmpNumber" : 452123 }
{ "_id" : ObjectId("54c0c7486ee638a21198793c"), "Name" : "Manohar", "EmpNumber" : 784521 }
Step 2:
Create a lib folder in your solrhome folder( which has bin and collection1 folders)
add below jar files to lib folder. You can download solr-mongo-importer from here!
- solr-dataimporthandler-4.7.0.jar
- solr-mongo-importer-1.0.0.jar
- mongo-java-driver-2.10.1.jar (this is the mongo java driver)
Step 3:
Declare Solr fields in schema.xml(assumed that id is already defined by default)
add below fields in schema.xml inside the <fields> </fields> tag.
<field name="Name" type="text_general" indexed="true" stored="true"/>
<field name="EmployeeNumber" type="int" indexed="true" stored="true"/>
Step 4:
Declare data-config file in solrconfig.xml by adding below code inside <config> </config> tag.
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
Step 5:
Create a data-config.xml file in the path collection1\conf\ (which by default holds solrconfig.xml and schema.xml)
data-config.xml
<?xml version="1.0"?>
<dataConfig>
<dataSource name="MyMongo" type="MongoDataSource" database="Test" />
<document name="import">
<!-- if query="" then it imports everything -->
<entity processor="MongoEntityProcessor"
query="{Name:'Rahul'}"
collection="sample"
datasource="MyMongo"
transformer="MongoMapperTransformer" name="sample_entity">
<!-- If mongoField name and the field declared in schema.xml are same than no need to declare below.
If not same than you have to refer the mongoField to field in schema.xml
( Ex: mongoField="EmpNumber" to name="EmployeeNumber"). -->
<field column="_id" name="id"/>
<field column="EmpNumber" name="EmployeeNumber" mongoField="EmpNumber"/>
</entity>
</document>
</dataConfig>
Step 6:
Assuming solr (I have used port 8080) and mongodb are running, open the following link http://localhost:8080/solr/dataimport?command=full-import in your browser for importing data from mongodb to solr.
fields imported are _id,Name and EmpNumber(MongoDB) as id,Name and EmployeeNumber(Solr).
You can see the result in http://localhost:8080/solr/query?q=*
You can try using SolrMongoImporter, it ask you to import 2 libraries into your solr proyect and create a data-config.xml.
You probably will need to import in your solrconfig.xml the following libraries if you don't have it
<lib dir="../../../contrib/dataimporthandler/lib" regex=".*\.jar" />
<lib dir="../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
If you have followed everything above and still facing the issue: check whether you have multiple jars in different locations.
i.e.
{solr-home}/dist/solr-dataimporthandler-8.10.0.jar
{solr-home}/server/libs/solr-dataimporthandler-8.10.0.jar
{solr-home}/server/solr/core/libs/solr-dataimporthandler-8.10.0.jar
If so, remove the jar files from everywhere but the location you have configured in the solrconfig.xml file.
I am trying to use JAAS to authenticate my users. My project is in GWT v2, which runs jetty. I use eclipse for development.
From http://code.google.com/p/google-web-toolkit/issues/detail?id=4462 I found out that jetty doesn't like any realm definitions in web.xml, so I moved them to jetty-web.xml.
I keep getting ClassNotFound exceptions so I followed the advice here: communitymapbuilder.org/display/JETTY/Problems+with+JAAS+in+Jetty+6.0.0
However, I am still getting ClassNotFoundExceptionsHere in my jetty-web.xml file. How do I configure jetty to work jaas in GWT projects?
My jetty-web.xml file:
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="serverClasses">
<Array type="java.lang.String">
<Item>-org.mortbay.jetty.plus.jaas.</Item>
<Item>org.mortbay.jetty</Item>
<Item>org.slf4j.</Item>
</Array>
</Set>
<Get name="securityHandler">
<Set name="userRealm">
<New class="org.mortbay.jetty.plus.jaas.JAASUserRealm">
<Set name="name">xyzrealm</Set>
<Set name="LoginModuleName">xyz</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/WEB-INF/classes/jdbcRealm.properties</Set>
</New>
</Set>
<Set name="authenticator">
<New class="org.mortbay.jetty.security.FormAuthenticator">
<Set name="loginPage">/login.jsp</Set>
<Set name="errorPage">/error.jsp</Set>
</New>
</Set>
</Get>
Error I am receiving:
[WARN] Failed startup of context com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload#1fcef4f7{/,/home/dev/workspace/project/war}
java.lang.ClassNotFoundException: org.mortbay.jetty.plus.jaas.JAASUserRealm
at java.lang.ClassLoader.findClass(ClassLoader.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at org.mortbay.util.Loader.loadClass(Loader.java:91)
at org.mortbay.xml.XmlConfiguration.nodeClass(XmlConfiguration.java:216)
at org.mortbay.xml.XmlConfiguration.newObj(XmlConfiguration.java:564)
at org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:907)
at org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:829)
at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:278)
at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:240)
at org.mortbay.xml.XmlConfiguration.get(XmlConfiguration.java:460)
at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:246)
at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:182)
at org.mortbay.jetty.webapp.JettyWebXmlConfiguration.configureWebApp(JettyWebXmlConfiguration.java:109)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1217)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:447)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:543)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:421)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1035)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:783)
at com.google.gwt.dev.DevMode.main(DevMode.java:275)
Apparently you need to include the optional 'plus' jar from the jetty's /lib distribution for jaas to work. That made the classnotfound exception go away.
I am trying to setup the embedded Jetty that comes with the GWT (2.0.3) Eclipse plugin to use a JNDI connection pool that works perfectly under Tomcat, without success. Now since i have read some things regarding the issue, i have managed to do the following:
Included the Jetty naming initial context factory to the classpath by launching the jvm with the following parameter: -Djava.naming.factory.initial=org.mortbay.naming.InitialContextFactory.
I have also created a jetty-web.xml that looks like this:
<New id="mysqltest" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>java:comp/env/jdbc/mysqldb</Arg>
<Arg>
<New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<Set name="Url">jdbc:mysql://192.168.0.5:3306/mydb</Set>
<Set name="User">testuser</Set>
<Set name="Password">testpass</Set>
</New>
</Arg>
</New>
<New id="db2test" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>java:comp/env/jdbc/db2db</Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.ibm.db2.jcc.DB2Driver</Set>
<Set name="url">jdbc:db2://192.168.0.6:50000/mydb2</Set>
<Set name="username">testuser</Set>
<Set name="password">testpass</Set>
</New>
</New>
</Configure>
and have included the neccessary files in my build path. As you can see, there are two JNDI resources declared there, a handle to a MySQL database using MysqlConnectionPoolDataSource (i saw that on a blog post) that works fine under my environment and used that to ensure that jetty was parsing the jetty-web.xml correctly and a second one that attempts to use DBCP to connect to a DB2 database. The problem is that whenever i try to use the DBCP resource i get the following error when Jetty starts up:
[WARN] Config error at <New id="db2test" class="org.mortbay.jetty.plus.naming.Resource"><Arg>java:comp/env/jdbc/db2db</Arg>...
[WARN] Failed startup of context com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload#7a74db2c{/,/home/..}
java.lang.IllegalStateException: No Constructor <New id="db2test" class="org.mortbay.jetty.plus.naming.Resource"><Arg>java:comp/env/jdbc/db2db</Arg>...
As i said, these work fine under Tomcat and the problem is not specific to DB2, i cannot get a MySQL Datasource using DBCP as well. Looking at the error message, it seems that the DBCP files are not in the classpath but i have no clue on how to put them there (they are of course in the projects build path but that seems irrelevant to Jetty). I probably have to add another parameter to Djava.naming.factory.initial but i am not sure whats the correct one for DBCP to work.
Cheers
I think you are missing an 'Arg' tag.
Try:
<New id="db2test" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>java:comp/env/jdbc/db2db</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.ibm.db2.jcc.DB2Driver</Set>
<Set name="url">jdbc:db2://192.168.0.6:50000/mydb2</Set>
<Set name="username">testuser</Set>
<Set name="password">testpass</Set>
</New>
</Arg>
</New>