How to change the default data-source in activiti BPM? - workflow

I would like to change the default data-source to oracle. So as per the user guide another database the db.properties in the WEB-INF/classes of the Activiti Explorer web application should be changed if i change the db.properties again i need to create .war file, correct ? How to i create the activiti-explorer.war file ? Or Is there any options for change it from explorer ? Please advise

I dont know the Activiti Explorer well, but you can build your war file from the activity sources.
Its a simple maven project and should be quite easy.
Have a look to the Activiti Documentation here: http://docs.codehaus.org/display/ACT/Developers+Guide#DevelopersGuide-Buildingthedistribution
BTW: I use Activiti embedded to spring framework using the spring-activiti extension... works like a charm.

No need to create WAR again you just put your war in server(tomcat or any other server) and start the server then it will generate an application folder parallel to war file in web-apps folder.
Change the db.properties in application folder generated in web-apps and restart the server.
changes in db.properties will reflect in web application.

Related

Running servlet within Eclipse requires libs to be defined 3 times - am I doing something wrong?

Hullo - issue is this:
I wrote a servlet in Eclipse which requires mysql-connector-java-5.1.22-bin.jar
To compile I need to add the jar via the project's "Java Build Path"
To deploy I need to add the jar to the project's "Deployment Assembly"
To run the servlet within eclipse I need to add the jar to the servlet's Run Configuration -> Classpath
It's not the end of the world re-re-repeating myself like this, but it does seem odd.
Given that Eclipse gets a lot of other stuff correct I'm guessing / hoping that maybe I'm overlooking some feature to avoid this silliness (I cannot imagine a scenario where you'd benefit from entering this in 3 different spots ... but maybe I'm being uncreative here ...).
Insights appreciated :-)
The only thing you need to do is to drop the jar in WebContent/WEB-INF/lib.
You are developing a Java Web project, so the traditional place to put the required libs (JAR files etc) is under /WEB-INF/lib. And you do it only once.
In Eclipse, when you create Dynamic Web Project the appropriate project structure is generated for you (this is a development structure). In this case you place your JAR files in ProjectName/WebContent/WEB-INF/lib folder. And this folder is *automatically included in the project's build path.
Considering the fact that it is a Java Web project (you said you use servlets) you have to deploy your web app to some Application Server, like GlassFish, JBoss, WebLogic, WebSphere etc, or more simple Web Container like Apache Tomcat. If you do this thru Eclipse, then again your web project is automatically deployed.
NB!
There may be some additional details related to using libraries.
For instance, when it comes to using database drivers (MySql, PostgreSQL, Oracle etc) Tomcat advises the following while configuring JNDI Datasource (quote):
Before you proceed, don't forget to copy the JDBC Driver's jar into
$CATALINA_HOME/lib
In your case (MySQL) see the example here: MySQL DBCP Example
Also see my answer related to Webapp configuration file organization convention.
Hope this will help you.
P.S. Here is a step-by-step example: How do I access MySQL from a web application?

Where do you put server.xml in a tomcat eclipse project when checking into version control?

When you create a tomcat project in eclipse, it puts the server.xml file under Servers, which appears as a separate "Project" in the project explorer. My question is, how best to check this into source code control, so that when another user attempts to check out the project, the server.xml file is in the correct place.
I currently use the Perforce version control system, but I've experienced the same issue in the past with other systems.
It's been my experience that other users will end up creating their own tomcat server in eclipse, and then they will have to copy in the custom server.xml.
The best I've been able to do is save the server.xml into the WEB-INF or other directory inside the project, and then update that to source code control. However, this introduces risk, because you have to remember to save your server.xml changes back to WEB-INF. Not to mention that you have to document the copying of the server.xml as a setup step for users creating your project.
I would create a folder under the web app project like etc/ where I'd put a big README and a hard link to the server.xml. So anyone checking out the project would be instructed to do the same (in the README) - and all changes to the server.xml would be versioned. I would not mess with WEB-INF - the server.xml has no place there.

How to deploy war on websphere 8 without using Admin Console?

How do we a deploy a simple war file on the websphere server 8 without using the websphere administration console?
As a part of the manual deployment I will need to know,
where to put the war file manually on the server?
war uses jndi for db connection, since we do not want to use admin console,
how do we create jndi data sources?
we would also want to externalize the properties file. (like I used to keep
application.properties in JBOSS_HOME/server/default/conf folder in jboss instead of the app.war/web-inf/classes)
Please help
PS: Actually we will be having an ant build which will do these three things for us so that we don't have to go to the admin console. Just run the ant build and it will copy war, create jndi etc stuff.
The best way of doing what you want is writing a wsadmin script.
Using wsadmin you can deploy, add/delete/modify resources in WebSphere, pretty much anything.
I would suggest you read Getting started with wsadmin scripting
You can also use 'monitoredDeployableApps' folder under server profile. You can enable this feature from the admin console -> Applications -> Global deployment settings.
Simple and best way to do this is in two steps: (v 8+)
Enable 'monitoredDeployableApps' feature in Admin Console -> Applications -> Global Deployment Settings and restart the server. (once restart you will see a folder in your profile 'monitoredDeployableApps' (default name and can be changed while enabling this feature)
Drag and Drop your war file in this folder (no restart needed) and observer Systemout.log of the server. Verify in Admin Console for the deployed application.
NOTE: Make sure your context-root is populating to your deployable (war,ear,...) files.
-- Prakash Karri

How to deploy Java web application project from Eclipse to live Tomcat server?

I have developed an web application using HTML, Java Servlet and all. While developing I was using Tomcat to deploy it in order to test it.
Now my development is done and I want to make it live. For that we have live server but as I am new to all this I dont know how to deploy my java web application on live server?
So please help me if you know to answer?
My Project Structure
ProjectName
->src
->beanClass
->class1
->Class2
->easyServlet
->Servlet1
->Servlet2
->Servlet3
->easyTrans
->Class1
->Class2
->Class3
->Class4
->build
->WebContent
->META-INF
->MENIFEST.mf
->WEB-INF
->lib(contain javascript files)
->web.xml
->html1
->html2
->html3
->html4
->html5
I am also using MySql so what I have to about it..
You will have to build a WAR of the project.
You can do this
in eclipse: right click on the project, Click "Export", and choose war file in the dialog (and mention, the destination, name and all)
via ant using the war task
The ant option is better because when you have multiple developers on the project and the code is in version control, it is easier to get the project automatically (using ant) and build a war. (you have version control, don't you?)
But this is more of an operational difference (albeit an important one) but the war created in either way are same
Deploy the war to the server
You can manually copy the war file to the $TOMCAT_HOME/webapps directory (See the "Creating and Deploying a WAR File" section on this article)
You can use the Tomcat 6 "Manager" application.
Update
You said that you are using MySql also. MySql should be installed on a server (it can be on the same server) and the configuration should be changed (username, password, server details) so that the application connects to the same database (I am sure you are not hard coding database details and credentials in your application and reading them from some configuration, this is the configuration that has to be changed)
For that we have live server but as I am new to all this I dont know how to deploy my java web application on live server?
I assume by this you meant , you have a public IP assigned to a server. Now you can install tomcat into this server and open the tomcat port for public and you will be able to access.
Now build a war file of your webapplication and put it into web-apps dir of the tomcat and start the server
Making a few assumptions here. You need
A tomcat instance running on your production server
Permissions to make changes to the tomcat instance
A war file that bundles your application
If you have both, then you need to navigate to the Tomcat manager page and follow the instructions to upload your war file.
Deploy the war to the server
You can manually copy the war file to the $TOMCAT_HOME/webapps directory.
You can use the Tomcat 6 "Manager" application.

Export a web project

i have made a web application using java pages with eclipse.
But i have no idea how to export it for use?
I was asked to provide a make file or somehting, what other ways can i do this from eclipse?
It sounds like you need to export it as a WAR file:
Right-click the project in Eclipse
Choose Export
Choose WAR File
Just right click on the project and say export war.
There choose the appropriate server runtime for which you have created the project.
Then put that war file inside the webapps folder in case apache tomcat and restart the server.
And you have done. :)