Tomee Installation process? - java

SPEC : jdk1.8 ,TOMEE702, win10
Question : How/What/which to install and use TOMEE for open-ejb3.X ?
url : http://tomee.apache.org/download-ng.html
I could not find any easy install-able for all of the downloads from the url.
with regards
Karthik

How to install
Just unzip the archive you downloaded.
which distribution
TomEE comes in several flavors which offer either alternative implementations for some of the specifications and/or additional functionality. Without more concrete requirements it's not possible recommend concrete flavor.
You can see the comparison here: http://tomee.apache.org/comparison.html Note that the table is for version 1.7 For 7.0.x, the details are in the text below.
The difference between plume/plus is that the first one uses eclipselink and mojara, while "plus" uses openjpa and myfaces.
The difference between web-profile and the others interms of ejb is that web-profile by spec supports ejb-lite, while plus/plume should support ejb full.
Also I'd recommend you to use the latest and greates version of tomee - currently 7.0.3 and upgrade to 7.0.4 as soon as it's released as it contains A LOT of fixes.

I think you want to know the way of using openejb with tomcat server.
To do that you will have to download openejb.war file.
http://tomee.apache.org/download/apache-openejb-3.1.4.html
After downloading openejb.war file download the tomcat server which can be downloaded from the link given below.
http://tomcat.apache.org/
Extract your tomcat zip file to a folder and deploy openejb.war file to tomcat's webapp folder.
If you are using Eclipse as an IDE then setup a tomcat server by going to window menu -> preferences -> server -> Runtime Environments. Add your version of tomcat server.
After adding the server, check the Project Explorer view, there you should see Servers folder. Finally right click on the project explorer view, select import and search for war file and lastly add the openejb.war file.
If everything goes well you should have successfully added openejb to your tomcat server.
If you have an openejb based project then you can add it by going to window menu -> show view and search for server. You should probably see the server view at the very end of your eclipse window. Right click on it and select Add and Remove. In the Add and Remove window you can control your projects deployment.
If you don't have a project then develop a project and add it to your server and run the tomcat server. You might also need to configure openejb.xml file depending upon your needs.

Tomee installation is no different then any other Tomcat installation. You should download the compressed file and extract it into your desired directory, preferably into root drive in case of windows extract it into the c drive.
Once extracted you can start it from the bin folder startup.bat or startup.sh script. Make sure you have the compatible jdk installed into your system and the path is configured for the JDK.
You can find the detailed installation step from the official documentation of apache.

Related

Unknown version of Tomcat was specified with tomcat -9.0.37

I downloaded the windows service installer of version 9.0.37.But at the time of connecting tomcat with eclipse IDE which is of version 2020-06 it is showing error that the version of tomcat was unspecified.
So please help me how can I configure my eclipse with tomcat-9.0.37
Look, you need to atleast open the folder once.
It will ask you the permission to enter after which it's contents will be visible to u as well as Eclipse.
So, after setting up and installing Tomcat, just go into the folder once, open it & then try connecting from Eclipse.
Instead of changing permissions, try this once!
From the WTP Tomcat FAQ: "To support searching for Tomcat runtimes, the contents of each directory being tested is checked for a set of content that uniquely identifies the version of Tomcat. These sets are based on the standard zip or tar.gz downloads from Apache. The packaged install for various versions of Linux (and even for other Operating Systems) might not quite match the expected set of files."
So get and unpack the zip file from https://tomcat.apache.org/download-90.cgi in a folder your user owns and use that instead (with its own port numbers or after disabling your Tomcat service).
I had the same problem. Later when I tried accessing the Tomcat folder from the file explorer, it said you need permissions to access this folder. This made me realize that the folder is in read-only mode.
So in the file explorer, right-click on Tomcat 9.0 folder, go to properties, click on the checkbox beside Read-only to deselect it and then click on OK.
Then again try the add server process in eclipse. It should work now.
Tomcat folder is in the following location :
C-> Program Files -> Apache Software Foundation
or wherever you have installed Tomcat.
I had first downloaded the .exe file in apache website and I had this same issue. I tried to change the permissions but it did not work so I went back to apache website and downloaded the .zip file. I extracted it to the same folder I have eclipse and closed and opened eclipse again. It worked this way.
You've to specify where the tomcat is, it can be from
a) Program files
C >> Program Files >> Apache Software Foundation
b) If tomcat is downloaded and you've zip,
Specify the Tomcat file location, don't select bin/conf folder, Tomcat won't be recognized but specify the folder of Tomcat Downloaded.
Doing any of these you can add sever in Eclipse
just try to enter C-> Program Files -> Apache Software Foundation -> tomcat ->bin and make sure there are files installed in this folder.
after that you can add the server in eclipse it will work.

How to Point Apache Towards a Vaadin (Java) Project?

Sorry if this is the wrong kind of question but currently I have an Apache server which is configured for Pyjamas. All I used to have to do was: pyjsbuild example.py and the GUI would appear in my browser.
I decided to switch to Java, so I picked Vaadin as my framework. How do I do the equivalent for Vaadin? All I want to do is compile the java and have Apache recognise it.
I'm using linux and I'm very new to building web applications, previously I only ever built the GUI side of things, I never had to touch the server.
You need Apache Tomcat to serve java pages. Install it separatly or see http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html for information on how to hook them together.
Vaadin projects work just as any web project. You have to crate a WAR file.
For example, if you are using Eclipse, right-click on the project, choose "Export..." and under "Web" choose "WAR file".
If you are using Netbeans or something else, google "create war in netbeans/intellij/..." to find out how to do this step.
This will generate a file with the extension .war, which you will have to copy in the "webbaps" folder of your Tomcat installation. Restart Tomcat and the application will be automatically deployed.
If you do not have access to the webapps folder, go to Tocatmcat's "Manager App" in the browser and
under the section "Fichier WAR à déployer"(WAR file to depploy) choose the generated file and click Deploy.
To start with, make sure that go through Getting Started chapter in Book of Vaadin. In this chapter you will find overview of the required toolchain and step-by-step installation instructions. Your Linux distribution might have more documentation about installing JDK (For example, see Ubuntu wiki for Oracle JDK installation).
It will be convenient for you to connect Tomcat to Eclipse IDE. This makes starting Tomcat and updating your application easy. For example, see this [blog] for some videos about connecting Eclipse to Tomcat.
Please note that using Eclipse is just one approach and later you might want to see if IntelliJ IDEA or command line works better for you.

Deployment to Tomcat using War file resulting in ClassNotFoundException

I am developing a web application and have hit a wall and could use some advice. So the application was written by a coworker who is no longer at our company. They wrote a web application for Apache Tomcat with Java and Javascript in the back end. The application makes use of the JDBC api to interface with a SQL Server database. This person did all the development in Eclipse and running it this way.
I am trying to take this web application and move it to a server. I attempted this by using Eclipse to export a WAR file and then placing this within the Tomcat webapps folder. Then when I started Tomcat the program was extracted. So far so good. The website comes up and works well. However, when I try to access the pages which rely upon database info everything is coming up NULL. I went through the Tomcat logs and found that in the standard out the following message was given:
ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
I had assumed that the WAR file would include all dependencies but I am guessing that probably this is not the case. If anyone is experienced, is this what has happened? If anyone out there is aware, is there a way to tell Eclipse to do this? Otherwise, what is my option? I am not a Java dev and so I would not know how to install JDBC if needed.
Any help is appreciated.
Mike
You can do the following
Go to Microsoft JDBC Driver download page and download the JDBC driver and install it to a location.
Open the .war file using a zip utility like 7-zip or winzip.
Copy the sqljdbc.jar from the sqljdb_4.0/enu directory where you installed the downloaded JDBC driver and paste it in WEB-INF/lib of the extracted war file.
Zip it back as .war file and deploy it again.
This will get the application running.
If you want to fix this permanently, then you should add the stop to include sqljdbc.jar to your WEB-INF/lib while building war file, in your build system, i.e. in build.xml if you are using ANT or in your Maven's pom.xml under dependencies section for this particular dependency.
You don't need to do the "Export WAR > copy to tomcat > start tomcat" manually, you could configure eclipse to do the deploy directly in your tomcat installation, firts double click tomcat server, and then select "Use tomcat installation" in the "Server Locations" section.
Make sure that your application contains the SQLServer JDBC driver (sqljdbc4.jar) in your project WebContent/WEB-INF/lib directory (assuming your coworker used the Eclipse "Dynamic Web Project" for the project layout), if not, download from here, unzip and copy it to the mentioned folder, the next time you start tomcat, it will automatically add it for you.
If the project uses the maven project layout (there is a file named pom.xml in the project root folder), use the following instructions to install the dependency in your local repository (there are some disagreements between Maven and Microsoft about licensing and redistribution of the driver, so there is no repo)

How do I properly deploy and structure projects in Eclipse against Tomcat?

I am relatively new Java developer that's been thrown in the deep end, my usual skillset lies in Microsoft products and C#.
However I have managed to write a nice web service using Restlet and incorporating Toplink and doing some database CRUD stuff, etc etc.
I developed this in Eclipse against Tomcat 5.5. I followed tutorials and examples and managed to throw something together that works.
I had all my jar files in WebContent/WEB-INF/lib directory of my project - I soon realised that when I export this as a WAR file and deploy in Tomcat, it takes these jar files with it and stores them local to the application.
Fine, but then when you try to undeploy the app, it only does it partially as Tomcat "holds on" to some of the jars it was using i.e. the Oracle JDBC, and Toplink ones. This makes sense as the web service was using these jars as there was a live Oracle connnection going on.
So then I thought I should have all these jars in a common place where all deployed apps can access them, that folder I believe is:
C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib
(in my case). This made total sense, it's logical as you don't want loads of apps on Tomcat all referencing the same jars. So I removed all the jars out of my projects lib folder and put them in the common\lib directory.
Now my app will not work properly - it can't find my source code in src, the custom bespoke code that I have programmed against these jars. It will only work if I jar up my source code and put in the directory stated above. Odd.
I am obviously very confused with class paths and build paths and all of that stuff, and must have got this sort of stuff all wrong as I am no Java expert, as I readily admit I have pretty much hacked this together - so can anyone explain to me in laymans terms how I should structure my project to get it working with jars held in a common folder in Tomcat. Or are there any good resoureces on the web to help explain to me what I should do.
Hope this all makes sense...
Here is a pic of my current project:
Sounds like you are not using WTP web project.
If you've installed 'Eclipse IDE for Java EE Developers' flavor of Eclipse, the WTP is already bundled in there. Otherwise here its update site -> http://download.eclipse.org/webtools/updates
Once you've installed WTP you should create 'Dynamic Web Project'.
In general I would recomment to put only your presentation layer here ( JSPs, CSS, HTML ) and put all pure java projects into standard 'Java' project that you later add as a dependency to 'Dynamic Web Project'.
WTP can run your web application under a number of containers, fortunately Tomcat is supported.
You will need to configure it through Window->Preferences->Server->Runtime Environments.
Once runtime envirnonment is configured, you can create your server runtime:
Right click in 'Servers' view.
Choose New->Server
Select server type: 'Tomcat v.5.5 Server'
(Optional) Change server name to whatever makes sense for you
Select server runtime environment: This is the Runtime Environemtn that you have configured previously
Hit 'Next' button
Add your 'Dynamic Web Project' project to 'Configured projects:' panel
Hit 'Finish' button
After the server is configured you can just run it, or you can put it in Debug mode. All source code referenced by dependent projects will be available for debugging.
NOTE:
From personal experience, I would not recommend using common/lib. Put all the jars that your web application relies upon into its WAR file. If you are worried about dependency tracking then start looking into Maven and m2eclipse.
Usually I put my jars in $CATALINA_BASE/shared/lib/
Please read this documentation for more clarification and specially Class Loader Definitions section.
Also restart the server after you copied the jars.
Go to Window > Show View > Other > Server > Servers, a servers tab will appear below with console tab. Click on your server and then F3, this will open server configuration.
Check Server Locations, and make sure you checked Use tomcat installation(takes control of tomcat installation) then click Modules tab below and it will show your installed modules, make sure the module is present or add it.

Eclipse Java EE IDE not supporting javax.servlet package

I downloaded Eclipse Java EE IDE to build Java Web Applications (servlets and JSP pages). But it still is not supporting the javax.servlet package.
Why? What's the reason? Is there any plugin that I need to install?
You need to integrate a servlet container in Eclipse and associate it with your Dynamic Web Project. Eclipse doesn't ship with a servlet container by default. You need to download and install it separately. A widely used one is Apache Tomcat. Just download the ZIP and extract it somewhere.
Then in Eclipse, go to the Servers view in the box at the right bottom. Then Add a new server where in you choose Apache Tomcat 6 from the list and point the Tomcat root folder (there where you extracted it). Then you can select it from the Target Runtime dropdown during the Dynamic Web Project creation wizard. Or if you already have created one but didn't associate it with a server, then modify it in the Targeted Runtimes section of the project's properties. This way the server's libraries will be automagically added to the project's buildpath. That's finally also the whole point. The server is basically a concrete implementation of the abstract Servlet API. It has all the API libraries in its /lib folder.
Here's a video tutorial (which does it a bit differently than above described, but it's also sufficient) and here's a text/screenshot tutorial (you can just skip the JSF part if that's not of interest yet).
You probably need to create a Dynamic Web Project instead of a normal Java project.
Or you can add a server profile to your workspace, and then add the server runtime to a Java project's libraries.
To add the server profile, go to Window -> Preferences -> Server -> Runtime Environments. Click Add..., choose the server type that you're using, specify the directory where that server is installed, and click Finish.
Now that you've added the server, you should be able to add it to the project as a library. Right click the project, then go to Properties -> Java Build Path -> Libraries -> Add Library -> Server Runtime, choose the server you just added from the list, and click Finish. This will make all the server's libraries available to your project.

Categories