How to deploy an web application in netbeans (prod / test) - apache

I have create an web app in Netbeans.
My project contains this architecture:
WebApplication
--web pages
----meta-inf
----web-inf
----index.html
--Source Packages
-----test
-------TestEnv.java
--Librairies
----JDK 1.8
----Apache Tomcat 8.0.27.0
----Configuration files
-------Manifest.mf
-------context.xml
-------web-fragment.xml
-------web-fragment.xml
How can I test if I am in production or test.
If It's a production , I will call a prod.properties
If It's a test, I will call test.properties
I already lookup some post like environment variable in tomcat server.xml but It's not recognized :(
I don't want to use maven also.
I am looking a solution based on a read of xml file.
If in the xml file prod is equal to true so It's in production so I call prod.properties.
Have you got an idea of this xml file .(similar to ant ?)
Thanks

Related

JavaMelody error - Monitoring of sql requests and of jdbc connections in GlassFish v4.1

I want to use JavaMelody to monitor the SQL requested by a Glassfish Application Server. There are step-by-step instructions on https://github.com/javamelody/javamelody/wiki/UserGuideAdvanced#monitoring-of-sql-requests-and-of-jdbc-connections-in-glassfish-v3
I followed the instructions (I didn't download javamelody-objectfactory.jar but used javamelody-core-1.54.0.jar instead) and I get this error when clicking on the refresh button (javamelody web page) :
server.log :
exception while collecting data
java.lang.NoClassDefFoundError: org/jrobin/core/RrdException
at net.bull.javamelody.Collector.getCounterJRobin(Collector.java:836)
at net.bull.javamelody.Collector.collectJRobinValues(Collector.java:489)
...
any idea how to resolve this ?
jrobin-1.5.9.1.jar is installed in the lib folder of glassfish (and in my ear project).
thanks !
javamelody-objectfactory.jar (java source included in the jar) and javamelody-core jar file are absolutely different things. The first is to make the datasource monitorable in Glassfish and the second is the monitoring tool itself.
First fix the exception. You should probably put javamelody-core jar and jrobin jar files in your ear project (and not one in lib folder of Glassfish and one in ear).
Then if the monitoring reports don't include SQL monitoring for the datasource declared in Glassfish, use the javamelody-objectfactory.jar including all steps as said in the doc.

Why is my moqui executable war file not allowing request to be found

I tried to follow the war generation instructions by changing the warName in build.gradle to moqui-plus-runtime.war and running gradle addRuntime and then gradle deployTomcat. There were no errors in the war build and I checked to see that the war file got installed as ROOT. I did not make any other changes (still using MoquiDevConf and I already had other system parameters in MoquiInit.properties.)
When I startup tomcat8, I don't see any errors in the log file and it says that it is loading moqui-plus-runtime, but when I make any request in the browser, the localhost_access... log shows 404 for any request.
Can you tell me what things I might of missed or how I would go about debugging this - there is very little info in the log files other than the 404 messages.
I followed the following steps to deploy to a Tomcat instance on the same machine. This is from memory as my production machine is currently offline for the next couple of weeks.
Edit tomcatHome to point to correct location
I personally run a gradle cleanAll first to remove old WARs etc
Run gradle build
Optionally run gradle loadProduction to load the production database, alternatively you can run java -Dmoqui.conf=conf/MoquiProductionConf.xml -jar moqui-1.5.3.war -load -types=seed,seed-initial so that you can pick which data types you want to load into production etc.
Stop Tomcat from running, probably optional but the next step deletes files & folders from a deployed tomcat instance.
Run gradle addRuntimeTomcat this task adds your runtime and also copies over the completed WAR into the Tomcat webapps directory if you set the location correctly in step 1.
Start Tomcat
Check Tomcat logs for any startup errors
Hope this helps

Running Jboss 7 using different config folder under standalone-servers

I'm used to jboss 5 deployment schemes where i use this command to deploy:
D:\jboss5\bin\run.bat -c ZZZ
which will deploy whatever in the jboss5\server\ZZZ folder
I have this structure on my jboss7:
D:\jboss7\
+standalone-servers
++ZZZ
+++modules
when i try to run jboss7 like this:
D:\jboss7\bin\standalone-servers.bat -c ZZZ
it complains with the following:
org.jboss.modules.ModuleNotFoundException: Module
org.jboss.as.standalone:main is not found in local module loader
#7559ec47 (roots: D:\jboss7\standalone-servers\modules) at
org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126)
at
org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275)
at
org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222)
at
org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:204)
at org.jboss.modules.Main.main(Main.java:262)
how to tell jboss7 to look for the right configuration that resides in the folder ZZZ?
appreciate for answers
By default the base directory for a standalone JBoss EAP 6 / JBoss AS 7 instance is ${JBOSS_HOME}/standalone
You can override this by supplying -Djboss.server.base.dir=ZZZ
You need to create ZZZ/configuration and ZZZ/deployment directories, and
place your standalone.xml file in ZZZ/configuration, then start jboss using the option.
standalone.bat -Djboss.server.base.dir=path_to_ZZZ
If your JBoss configuration file is not called standalone.xml then you will also need to add
-Dtarget.appserver.configfile=my_standalone_config.xml
The JBoss instance base directory does not need to be within the ${JBOSS_HOME} subdirectory tree. In fact it is better to keep it somewhere separate as it allows you to update / reinstall JBOSS binaries without overwriting your configuration files.
The modules folder should remain within ${JBOSS_HOME}
So if your ${JBOSS_HOME} were c:\jboss7 it would look something like
C:\jboss7
+bin
+modules
+standalone <- not used!
... etc
c:\standalone-servers
+ZZZ
++configuration
+++standalone.xml
++deployments
A possible reason is your jboss runtime is corrupt. Reason for
**org.jboss.modules.ModuleNotFoundException: org.jboss.as.standalone:main
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:224)
at org.jboss.modules.Main.main(Main.java:341)**
is that jboss-eap-6.2\modules\system\layers\base\org\jboss\as\server\main package is missing inside your jboss directory. This package contains jboss-as-server-7.3.0.Final-redhat-14.jar and module.xml which are essential to run jboss server.

Unable to build Worklight project for "test" server (JDBC error)

Hello worklight team and devs!
We are done working on our development project and everything works fine in the local dev server (Tomcat).
Now we are trying to build the project to be deployed to a testing WAS ND 8.0.3 server.
We've been following the manual in the infocenter and modified each required file as needed (worklight.properties and application-descriptor.xml)
We made this changes to the worklight.properties file:
publicWorkLightHostname=working.hostname.com
# http or https
publicWorkLightProtocol=http
# For default port leave empty
publicWorkLightPort=ourport
publicWorkLightContext=/worklight
wl.db.jndi.name=jdbc/WorklightDS
wl.db.type=DB2
wl.db.url=jdbc:db2:Worklight
wl.db.username=wluser
wl.db.password=passwd
We tested the jdbc source in the WAS console and it works perfectly.
We proceed to build the war, adapter and wlapp (ALL) and we get this error:
[2013-05-21 12:48:44] FWLSE4001W: Failed to resolve JNDI name: "jdbc/WorklightDS".
Application may fail to access the database in runtime. If building for remote server - ignore this warning.
[2013-05-21 12:48:44] FWLST0011E: ====== Worklight Project BPMWorklight-project-customization failed to start: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
[2013-05-21 12:48:44] Activation failed. Bundle didn't start:C:pathto\BPMWorklight-customization.jar
This happens in the developer workstation and if we install Studio in the server, where the jdbc source is created, the same happens.
I guess that Worklight is trying to "obtain" a JDBC source in TOMCAT not WAS, but we are building for WAS, so the build fails and NO files are changed after the error. NO BUILD is executed.
We also tried to execute the build.xml with ANT in studio but we get this error:
Buildfile: C:\Users\Primary User\IBM\Worklight\LIS_SampleCollection\BPMWorklight\build.xml
BUILD FAILED
C:\Pathtofile\BPMWorklight\build.xml:3: Cannot find ../../common.xml imported from
C:\Pathtofile\BPMWorklight\build.xml
Total time: 62 milliseconds
You're help is greatly appreciated!
Thanks a lot!!
Best,
Nicolas E.
If all you require is to deploy the updated-for-WAS .war file in WebSphere, you don't need to do any build operation in Worklight. After updating any file under the server\ folder in Worklight Studio (the Eclipse plug-in), the .war file is automatically being re-created.
The build operation is mainly for creating the binaries and deploying to Worklight Server (database) (again, when using the Eclipse plug-in).
So what I suggest is to:
First update application-descriptor.xml with your context root value in worklightServerRootURL, and keep your .wlapps on the side
Update worklight.properties and save them.
Now you have your app ready to deploy and the .war file ready to deploy.
Move to WAS, deploy the .war file
Hopefully things will work now, so you can load Worklight Console and deploy the .wlapp and .adapter files.
I don't know what you've read in the IBM Information Center, but you can also try going over the following training module from IBM Worklight Getting Started.
Moving from development environment to stand-alone QA and production servers
Notes:
The above is not so convenient, but it is A way to move from your
development environment to another staging environment, or
application server...
The issue might also happen even after following my steps above, and this will indicate that the real issue is in your DB2 declaration in worklight.properties.
I will update this answer tomorrow with some insight regarding the possible DB2 declaration issue.

is solr can start by developer trunk or how to start by developer trunk

I have downloaded solr from :
http://svn.apache.org/repos/asf/lucene/dev/trunk/
and when i try to start solr by :
/solr/example/java -jar start.jar &
and try to open in browser at 8983 port it is not opening saying ?
HTTP ERROR: 404
Problem accessing /solr/admin/schema.jsp. Reason:
NOT_FOUND
Powered by Jetty://
how to start by developer trunk actually want to use solr 4.0
If you have downloaded the source code from trunk, it does not come bundled with the solr.war.
Can execute ant command from the base directory OR
Build the artifacts for solr by executing ant dist from the solr folder
Once the artifacts is built, you will find a dist folder with the apache-solr-xx.war
You would need to copy the war (and rename to solr.war) into the /solr/example/webapps/ for solr to be available.
This should get you started.
Example steps -
1. svn checkout http://svn.apache.org/repos/asf/lucene/dev/trunk/ solr_trunk
2. cd solr_trunk
3. ant or ant dist (from solr folder)
4. Copy the war file (and rename to solr.war) from solr/dist folder to /solr/example/webapps/
5. /solr/example/java -jar start.jar
See the README.txt:
To compile the sources run 'ant compile'
This will compile you the solr.war.