I am working on single solr app. I downloded solr exampple code for net, which is working fine while running on jetty server.It is having data which are to be indexed in C:\apache-solr-1.4.0\example\exampledocs and the indexes are stored in C:\apache-solr-1.4.0\example\solr\data, using jetty server indexes are created using command java -jar post.jar *.xml. Now i want to know how can i achieve this using Tomcat. do i need to change the configuration to change the path for indexe storage and for xml files storage. how data will b indexed so that i would able to search it.
If I understand your question correctly, you'll want to use the -Durl flag when running post.jar, e.g.:
java -jar -Durl=http://localhost:8080/solr/update post.jar solr.xml monitor.xml
In solrconfig.xml you can mention the path that has to hold the index
<dataDir>${solr.data.dir:}</dataDir>
I think you just have to read more from SOLR documentation, and click through what you have in the package.
There is an tomcat deployment doc in solr wiki:
http://wiki.apache.org/solr/SolrTomcat
And the war file is in the dist folder you've downloaded.
How to search it? There is no simple answer. I suggest you read more on the solr wiki. Find out what is a handler, what is the difference between dismax handler and standard handler, how schema.xml defines the database.
Related
I have checked out Googles code example for the Guestbook. It builds locally and I can deploy it to my local machine and it is working out ok.
When I try to deploy it to Google App Engine this happens in the log:
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found. recommended index is:
- kind: Greeting
ancestor: yes
properties:
- name: date
direction: desc
The suggested index for this query is:
<datastore-index kind="Greeting" ancestor="true" source="manual">
<property name="date" direction="desc"/>
</datastore-index>
at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:56)
After a bit of Googling I find people that suggest one of two things. 1) Do some editing in the YAML. 2) Manually modify the TARGET and add some index config.
I'd like to avoid both because 1) In the latest Guestbook code sample there is no YAML and 2) I prefer to automate my build than to manually hack it every time I want to deploy.
Is there any way to make this work when using mvn appengine:deploy ?
This is the guide I have been using : https://cloud.google.com/appengine/docs/standard/java/tools/using-maven
It's perfectly normal (sometimes even required) to manually modify the datastore index configuration file according to your app's specific usage. The reason for which such file may be missing from the sample code could be that it is typically auto-generated. From Cloud Datastore Indexes:
Important: For an in-depth discussion of indexes and querying, see the article Index Selection and Advanced Search.
App Engine predefines a simple index on each property of an entity. An
App Engine application can define further custom indexes in an index
configuration file named datastore-indexes.xml, which is
generated in your application's /war/WEB-INF/appengine-generated
directory . The development server automatically adds suggestions to
this file as it encounters queries that cannot be executed with the
existing indexes. You can tune indexes manually by editing the file
before uploading the application.
You should also note that the datastore index configuration is an app-level configuration, shared by all app's services/modules, even if they're not written in Java. Which is why you may see references to both datastore-indexes.xml (java-only, the suggested index format in your message is for this file) and index.yaml (all languages).
Another important note is that the index configuration can be deployed independently from the service/module code, including with maven. From App Engine Maven Plugin Goals and Parameters:
appengine:deployIndex
Deploys an index.yaml configuration file to App Engine.
So just use this target to update your datastore index configuration.
I want to convert spring application into angular js. I am using some external css and js.
css is included properly but not js.
when I use
<script src="bower_components/angular/angular.min.js"></script>
It is considering angular.min.jsp and throwing error not found.
How to include external js into my app.
It seems as some misconfiguration on the server side.
I would suppose that you are using Apache 2.4 or Tomcat 7
In Apache 2.4 take a look at https://httpd.apache.org/docs/2.4/rewrite/remapping.html
If you were running the application in the ubuntu then default location to look at would be /etc/apache2 and usually this is going to be found in /etc/apache2/sites/available/000-default.conf
In Tomcat 7 take a look at
https://tomcat.apache.org/tomcat-8.0-doc/rewrite.html
Under Ubuntu with the default installation of Tomcat, this information will be found either in the file /var/lib/tomcat7/conf/server.xml or under the directory your application is deployed in META-INF/context.xml or under /var/lib/tomcat7/Catalina in one of the subdirectory. This depends a lot on the settings you have.
If neither of these is a case then take a look at the filters applied to the application as some of them can screw the answer. For them take a look at WEB-INF/web.xml or if you are using the XML-less configuration then try Some of the I believe SpringWebApplication classes.
If you still use the Spring to serve the backend then it is also possible that you have incorrectly set up ViewResolver, which returns .jsp as appendix instead of .js
I have a Java application which runs on an Apache Tomcat server. The Java application is a web service.
From within one of the Java classes I try to access a file, however the following section of code throws a FileNotFoundException.
DataModel dm = new FileDataModel(new File("data/WheelChairData.csv"));
However if I run this Java application without using the server, I don't get the error message which means that it's apache that's not be able to find it. So where can I store the file WheelChairData.csv so that the server can find it ? is it possible to store it within Apache Tomcat, if so can you please point me in the right direction
Thank you.
Use this line and see where the path is:
System.out.println(new File(".").getAbsoluteFile());
(or if you are using logger, put output into it)
I create JDBC Connection pool for my Oracle db inside GlassFish admin console.
This pool has some properties, including URL=jdbc:oracle:thin:#//192.168.1.250:1521/MYDB
I'd like to read this jdbc property from my java code (I use web project + ejb, simplified packaging inside .war file).
How can I do that?
You can find all the information you are looking for in the domain's XML file, usualy located at: %glassfish_home_directory%\glassfish\domains\%NAME_OF_YOUR_DOMAIN%\config\domain.xml
you can easily parse it using java's built in support for XML parsing, such as DOM
You can also try using the embedded API to run the asadmin command to get results. Check out this blog entry using the CommandRunner object:
http://weblogs.java.net/blog/bhavanishankar/archive/2011/09/12/embedded-glassfish-programatically-running-asadmin-commands-servlet
perhaps you can try "list-jdbc-resources" or similar asadmin command to get the data.
Hope this helps.
I configured Import Handler for fatching data from MySql data base. In the solr example which i downloaded from net in C:\apache-solr-1.4.0\example\example-DIH\solr\db\lib there is hsqldb-1.8.0.10.jar.
I want to know:
since i am using MySQL do i need to
put jar for MySql.
please be sure to check out the Solr Wiki as it very much describes the process of indexing data from a MySQL database.
As for you question regarding where to put the MySQL connector jar (in my case it is called the "mysql-connector-java-5.1.12-bin.jar")... you will need to place this jar in the C:\apache-solr-3.1.0\example\lib\ folder.
Hope that helps!