How to start and Stop SOLR from A user created windows service - service

I had a two bat files start.bat and stop.bat for starting and stopping SOLR server manually,
Is it possible for me to create a windows serive which will call start.bat on starting the service and also call stop.bat on stopping the sERVICE

Consider Solr Multicore feature with Tomcat. Each core is like a fully fledged installation, "separate configurations and indexes, with their own config and schema for very different applications, but still have the convenience of unified administration" http://wiki.apache.org/solr/CoreAdmin
Even if you dont use multiple indexes, it's much more elegant to set up. Solr is available on startup if Tomcat is set that way. I assume you are using Solr 1.4.
You need to do these steps:
Set up a solr root directory
Overview
c:\solr
|-lib
|-solr.war
|-solr.xml
Create c:\solr
from the Solr package directory, copy the lib directory to the root dir.
from \example\webapps of Solr package directory, copy the solr.war
solr.xml has the following contents
<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="false" sharedLib="lib">
<cores adminPath="/admin/cores">
<core name="myindex" instanceDir="myindexdir" />
</cores>
</solr>
The core parameter specifies a new core. The attributes specify that for serving http//localhost:8080/mysearchapp/myindex, the index directory is myindexdir, which brings us to the next step.
Create the actual core
Overview
c:\solr
|-lib
|-solr.war
|-solr.xml
|-myindexdir
|-bin
|-conf
|-data
copy the conf directory, where you have done your configuration to myindexdir. Dont bother creating bin and data, it will be automatically created.
Set up tomcat
install Tomcat, run it once (dont skip this) and open http://localhost:8080 to see if it is successfully installed
Of course, set it to start on boot by using services.msc
Open this directory
Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost
Create the file mysearchapp.xml
Context docBase="c:\solr\solr.war" debug="0" crossContext="true" >
<Environment name="solr/home" type="java.lang.String" value="c:\solr\" override="true" />
</Context>
Restart tomcat and open http://localhost:8080/mysearchapp/
If all goes well it will display
Welcome to Solr!
Solr Admin myindex
Now do your operations on your core like http://localhost:8080/mysearchapp/myindex/select?q=MY-QUERY

Solr runs on top of a Servlet container like Tomcat. So for starting Solr you have to configure Solr with your Servlet container and then start.
Yes you can of course create a Windows Service. However you have not mentioned which Servlet container are you using for running Solr?
If it is Apache Tomcat here you go:
1. Just go to tomcat/bin folder from command prompt
2. Say service.bat install
3. You can see the service being listed in the Microsoft Services
Application
4. Right click on the service and add solr home (in Start
parameters). For an example if your Solr home is in D drive then:
-Dsolr.solr.home="D:\solr"
5.You are done. Just right click on the service, start it or even you can set
it to start automatically when your system starts.

Related

WildFly: jboss-cli's add module creates a wrong folder

I am taking my very first steps with WildFly application server. I want to create a database driver.
I had a look at https://www.adam-bien.com/roller/abien/entry/installing_oracle_jdbc_driver_on on how to do it manually. And now I want to do it by jboss-cli.sh. I read about these commands e. g. here and here.
So I am typing...
wildfly-26.0.0.Final/bin$ ./jboss-cli.sh -c
[standalone#localhost:9990 /] module add --name=com.oracle --resources=/home/user/Downloads/ojdbc8.jar --dependencies=javax.api,javax.transaction.api
The command is going to be executed without error.
I would expect it to
create the module-subfolders (step 2 in the linked tutorial by Adam Bien)
copy the JAR file to the newly created folder (step 3)
create the module.xml file (step 4)
maybe even to add the necessary <driver /> tag in the standalone.xml (do not know if that should be part of the add module command?) (step 5)
Basically it does a lot of that, but different than I expect.
It creates the subfolder in a wrong(?) location. It is not created in [WILDFLY_HOME]/modules/system/layers/base/com/oracle/main like it is decribed by Adam Bien but it is created [WILDFLY_HOME]/modules/com/oracle/main. The JAR file is correctly copied, the module.xml file is created but the folder seems to be wrong. And the standalone.xml is not altered at all.
If I start the web management console I do not see the driver next to the default H2 one.
So my question is what am I doing wrong with the command so that the folder is created in the correcy localtion? Or does this work as designed and the location is not that relevant and I am making other mistakes that it does not show in management console nor in standalone.xml?
By the way, I also tried to change the command module add --name=system.layers.base.com.oracle .... Now the folder was correct, but in the module.xml the name of the module was also system.layers.base.com.oracle.
I tested with WildFly 26.0.0 and WildFly-preview 26.0.0 under Ubuntu.
It should not be created in modules/system/lasers/base. That is for components provided by the container. Having the module off the root $JBOSS_HOME/modules directory is correct.

How to change default H2 database to Postgresql for Kie Workbench (JBPM 7.2.0) running under existing under Wildfly (10.1.0) manually?

I have an existing Wildfly installation containing other apps. Besides that I want to deploy Kie Workbench too. Here I do not want to use the demo installation using Ant, which starts downloading and installing JBoss afresh.
My existing environment is below.
OS: Windows Server
Database: Postgres 9.6.1
JDBC: postgresql-42.1.4.jar
App Server: wildfly-10.1.0.Final
BPM/Drools App: kie-wb-7.2.0.Final-wildfly10.war
I deployed the Kie Workbench by downloading the war file from here:
https://repo1.maven.org/maven2/org/kie/kie-wb/
Now I would like to change the default H2 database driver with Postgresql 9.6.
Prior to this I created users and datasources already and had a workable kie-wb site, but only problem is: it is running on H2.
Any help appreciated in replacing H2 with Postgresql driver.
This post explains how to use Postresql with Wildfly 10.
According to this page you can just drop the Kies application to the deployments directory. This means probably that it uses the "default" H2 data source. Hence you must change jndi-name and pool-name of the newly added Postgresql in step 1 to those of the H2 and comment the H2 data source.
I performed the below steps. But somewhere I went wrong, not sure where. I am unable to login to the kie workbench.
JBPM App Server Configuration for PostgreSQL
Uncompress the zip file: jbpm-installer-full-7.2.0.Final build.properties file
Update release.version=7.2.0.Final in
Remove references of H2 in build.properties file
Add postgresql references in build.properties file including jdbc driver details and download url
Change H2 hibernate dialect to that of PostgreSQLDialect in jbpm-persistence-JPA2.xml file
Change all H2 reference and replace with PostgreSQL in standalone-wildfly-10.1.0.Final.xml, standalone-full-wildfly-10.1.0.Final.xml files
Change default datasource to jBPMDS in those two files:
Upload Postgres Driver and create module.xml file with the postgresql driver using JBOSS-CLI commands.
Issue the below ant commands from the directory of the expanded zip files:
ant clean.generated.ddl
ant download.ddl.dependencies
ant install.jboss
ant install.jBPM-console.into.jboss
Make sure standalone.xml and standalone-full.xml are being copied into the Wildfly configuration directory correctly.
Move the wildfly directory to the location of the JBOSS_HOME, or create environment variable pointing to the same.
Create the directory modules\org\postgresql\main in JBOSS_HOME home and copy files: module.xml, postgresql-42.1.4.jar
Add admin user in the Management Realm: admin
Add JBPM users with roles in braces in Application Realm: kieserver(kie-server), workbench(admin,kie-server)
Run the sql scripts from ddl_dependency folder as the ant script is failing.
Issue standalone -b 0.0.0.0 -c standalone-full.xml command
Bing! you are done!

IBM Liberty issue

An architect is having issues bringing Liberty up. Currently, an individual is running a server on his local computer and they want to move it to a shared server. When he tries to deploy a simple “helloworld” it’s failing and he is receiving an error “Context Root Not Found”. He is not sure what to set in server.xml file to have wlp recognize the application. They have ODM 8.5 on the mainframe. He thinks it might help if he saw an example of an EAR or WAR file deployed. Any ideas or suggestions?
Either put your application in the dropins folder, it will be detected and started automatically, or put it in the apps folder and configure in server.xml like this:
<webApplication id="HelloApp" location="HelloApp.war" name="HelloApp"/>
by default context root is application file name without extension, but you can change it by adding contextRoot="mycontext" attribute.

deploy adempiere project .war file on jboss server

How To deploy Adempiere project .war file on jboss server?
Kindly describe the steps briefly.
Manually Adempiere deployment is some what more complicated. You can't find the only one specific .war file in adempiere.
If you are going to do adempiere manually deployment then you need to find the following
*.jars and *.wars from source and place the jars and wars in respective places in jboss application server
webui.war
adempiereApps.war
adempiereRootBase.war
Adempiere.jar
AdempiereApps.jar
AdempiereRoot.jar
CCTools.jar
CSTools.jar
CompiereJasperReqs.jar
Generating the Adempiere Installer :- (You can download adempiere installer from sourceforge also)
Adempiere already integrated with jboss 4.2.3. For getting adempiere installers sake you need run the *ADEMPIERE_Trunk/utils_dev/build.xml* using ant. then system will craete installers for you. These installers are available *ADEMPIERE_Trunk/adempiere/install*.
Now copy these installer (.zip or .tar.gz) and place into your desired server location and extract it. Ex :-( C:\Adempiere or /home/user/Adempiere, this path we called as ADEMPIERE_HOME)
To Configure Adempiere server :-
open up a console window and go to the $ADEMPIERE_HOME/ directory. Run the script RUN_setup(.bat or .sh depending on your OS), Now it will open a popup enter your data (related to database configuration , application server configurations and ports) and click on the OK button. after 1 to 2 Minutes the process will be completed.
To Run Adempiere server :-
To run the ADempiere Server from a console, open up a console window and go to the $ADEMPIERE_HOME/utils directory. Run the script RUN_Server2 (.bat or .sh depending on your OS).
Now you can access from browser.

Configure the path (localhost) of the war application to be the root (Java EE)

I want to change the path when I run my war-application locally...
Right now, it is running on the default setting...
http://localhost:8080/myproject-war/
and I want it to be the root, something like:
http://myproject-war.local/
or
http://myproject:8080/
How can I do that???
Note: My app is a Java EE 6 Application with Glashfish using Netbeans 7.3
This post helped me out How do you deploy a WAR that's inside an EAR as the root (/) context in Glassfish?.
First, I added a Standard Deployment Descriptor (application.xml) to the Enterprise Application Project.
Then, change the path of the context root of your web application: <context-root>/myproject-war</context-root> to <context-root>/</context-root> or <context-root />
Finally, (optional) remove or rename the Glashfish index page (or redirect it to the welcome page). located in the Glashfish default folder such as C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\docroot
Now the page web application will be visible on: http://localhost:8080/
Maybe you are mixing up stuff here - one thing you can and should do is setting the context root of your application. This is done in the server's deployment descriptor - in your case in glassfish-web.xml:
<context-root>/myproject</context-root>
(See The Java EE 6 Tutorial for more details.)
What you're asking in your example URLs is changing the host name, which is not related to your application or application server, but to your machine and OS settings.
You may put something in the OS hosts file (/etc/hosts on Linux, C:\Windows\System32\drivers\etc on Windows), but I don't see the point to do this. Your application runs on some host (may it be localhostor some external server) and this is how your URL starts.
you can put entry in host file. which is located in "C:\WINDOWS\system32\drivers\etc".
127.0.0.1 your_project_name