How do I create data source in eclipse level in atg .? - eclipse

How do I create data source in eclipse level in atg .?
I have removed jdbc folder from config and configured that jdbc folder in eclipse.
On build of Eclipse, that data source file needs to point the database and needs to start the server.
Like dynamo/ admin / or project need to up.
Can anyone help me with how to do these?

Related

no archetypes in default local catalog when creating new maven project

Using Eclipse Java EE IDE for Web Developers. Version: Kepler Service Release 2
Build id: 20140224-0627.
When I select File -> new -> Maven Project -> Use Default Workspace Location. I get the following Dialog. Local Default Catalog is empty:
I click Configure button, and then click on Maven Architecture Catalogs. The page says:
Location of catalog files
The Archetype Plugin knows by default about its internal catalog. It
also knows about the local and remote catalogs.
local represents the ~/.m2/archetype-catalog.xml catalog file.
remote represents the
http://repo.maven.apache.org/maven2/archetype-catalog.xml catalog
file.
The Archetype Plugin can also read catalogs from filesystem/HTTP by
providing the path/URL of a catalog file or of a directory containing
an archetype-catalog.xml file.
If Execute the following on the command line (I have everyhing under tools directory, Eclipse, Maven, WildFly, etc.)
C:\Tools>dir archetype-catalog.xml /s
It doesn't find any file.
So default local catalog doen't exist! Why is that?
I have downloaded http://repo.maven.apache.org/maven2/archetype-catalog.xml, but I don't know where to put it to become the default local catalog, because I don't know what ~/.m2/archetype-catalog.xml file path is. I tried with C:\Tools\eclipse\.m2\archetype-catalog.xml and several other locations without luck. Sorry, I'm new to Java eco-system and Eclipse IDE.
I have the latest M2Eclipse found here: http://download.eclipse.org/technology/m2e/releases
EDIT: I figured out what ~ means on ~/.m2/archetype-catalog.xml. I have put archetype-catalog.xml into c:\users\my.user.name\.m2\ and voilĂ  default local catalog is now full of archetypes. But still. Why it didn't exist in the first place? This is very annoying.
The archetype catalogs used by eclipse can be found in Window -> Preferences, then in the section Maven -> Archetypes. If no catalog is listed there, you can add the official maven remote catalog: http://repo.maven.apache.org/maven2/archetype-catalog.xml
No need to configure local archetypes unless you have created your own archetype. In this case, when you install it on your machine, the maven will create the archetype-catalog.xml file on the ~/.m2/repository path. In another case, to retrieve any artifact the only things that you need to do is configure the remote catalog, for example, to configure Spring Catalog, you need the following
If you see the following screen, you can observe that I don't have anything in my Default Local Catalog similar to you while in All Catalogs, I have the archetypes from other repositories.
Finally is important to know the difference between archetypes and dependencies. The archetypes let us create a project from it, the others are the libraries to own the project.

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

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.

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.

Connecting Eclipse JSP Page with MySQL DataSource

I need to connect MySQL datasource to a jsp page through eclipse. I need to add, delete and read data from tables. I am using Eclipse Helios, Tomcat Apache 7 and Struts 2. I found some related page How should I connect to JDBC database / datasource in a servlet based application? but i dont know how to use public Database().What do i import. Also pls tell me some simple procedure to add and access data from tables.
You need to learn JDBC first - http://download.oracle.com/javase/tutorial/jdbc/index.html - and then you need to add the appropriate Java MySQL driver to your application so that the JDBC connection creation string can locate it.
Start with the tutorial.
Edit: A very good JDBC-based database exploration program is the DBVisualizer - http://www.dbvis.com/ - where the free version can help you getting started as well as help you investigate database contents and an easy SQL editor for getting the selects right.
You have to download mysql server and MySqlWonkbench for better UI. https://dev.mysql.com/downloads/workbench/
You have to add mysql.jar file to run mysql on your eclipse.
https://dev.mysql.com/downloads/connector/j/5.1.html
Add jar file to your eclipse project
Rightclick on your project --> properties --> java Build path --> add external jar --> select your mysql jar from your pc.
refer this video
https://www.youtube.com/watch?v=5vzCjvUwMXg
refer this code for login/signup fusing jsp + mysql
https://github.com/Aksh0369/log_sin_jsp-MySql