Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I just got an application from our client for reference. It looks like a java application however not sure, since i am .Net developer. Here is the structure of the application:
app
components
data
framework
libs
META-INF
plugin
resources
storeserv
WEB-INF
and then some html ,javascript files at the root.
I just want to run this application on the browser for now.
Can anyone please confirm if this is java application? If yes, please let me know how to launch the same on the browser (I am not sure if this is published or the code itself). I could not find any class, jar files anywhere in this app.
Thanks in advance.
The given project is a WEB-application for Java.
To run it you need a Web Application container (like Tomcat or Jetty) and deploy it to this Web Application container. Then you can browse the application.
Yes it looks like a Java web application.
To run it : Install Apache Tomcat. Note the installation port in your installation.
Inside the META-INF folder (of your client files) you will probably find a context.xml file. Open it in a text editor and note the path. It will be something like <context path="/appname">
Then place all the files in $CATALINA_HOME/webapps/appname , where $CATALINA_HOME stands for the installation directory of the Tomcat Server.
Then restart your server(this might not even be necessary).
Access the application at URL: http://localhost:port/appname
Enjoy
In order to be executed, a web application must be deployed on a servlet container(Tomcat, Jetty etc.). This is true even during development. I will describe using Tomcat 6 to provide the execution environment. A web application can be deployed in Tomcat by one of the following approaches:
Copy unpacked directory hierarchy into a subdirectory in directory
$CATALINA_BASE/webapps/. Tomcat will assign a context path to your
application based on the subdirectory name you choose. We will use
this technique in the build.xml file that we construct, because it is
the quickest and easiest approach during development. Be sure to
restart Tomcat after installing or updating your application.
Copy the web application archive file into directory
$CATALINA_BASE/webapps/. When Tomcat is started, it will
automatically expand the web application archive file into its
unpacked form, and execute the application that way. This approach
would typically be used to install an additional application,
provided by a third party vendor or by your internal development
staff, into an existing Tomcat installation. NOTE - If you use this
approach, and wish to update your application later, you must both
replace the web application archive file AND delete the expanded
directory that Tomcat created, and then restart Tomcat, in order to
reflect your changes.
The description below uses the variable name $CATALINA_BASE to refer
the base directory against which most relative paths are resolved. If
you have not configured Tomcat 6 for multiple instances by setting a
CATALINA_BASE directory, then $CATALINA_BASE will be set to the value
of $CATALINA_HOME, the directory into which you have installed Tomcat.
You can visit this youtube link for video tutorial.
Related
I've been using tomcat run configuration without any problems - it does a excellent job. However I kind of don't like the fact that it is not documented anywhere (or is it?) how this magic actually happens.
I suppose it somehow makes tomcat reference app created from artifact within target directory (if using maven). I also noticed that when using manager-gui app there are no other applications deployed so it must not use tomcat/webapps dir.
What I am curious is:
How does it start tomcat to point at the application outside tomcat home?
Does it deploy my app using {project_dir}/target/{appName}?
Where is the manager-gui app?
Where are the logs and conf files?
I'm using IntelliJ IDEA 15.0.3, Tomcat 8.0.15 and JDK 1.8.0_31
This is an excerpt from C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.2\bin\idea.properties:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.system.path=${user.home}/.IntelliJIdea/system
idea.system.path=D:/dev/IntelliJ-Settings/system
In File --> Settings... --> Build, Execution, Deployment --> Application Servers I've defined this: (look at Tomcat base directory)
D:\catalina-base-idea contains the global Tomcat configuration for IntelliJ.
When I deploy my webapp using IntelliJ run configuration, the web app will be deployed to D:\dev\IntelliJ-Settings\system\tomcat (see idea.properties).
The above explains question 1.
Question 2: afaik, target is only used for building, not for deploying.
Question 3: there is no manager app within D:\dev\IntelliJ-Settings\system\tomcat\webapps
Question 4: logs are within D:\dev\IntelliJ-Settings\system\tomcat\webapps\yourApp . The global Tomcat config is located in D:\catalina-base-idea.
You can configure the Tomcat for IntelliJ so that it uses a port other than 8080. So you can start your standard Tomcat and IntelliJ Tomact at the same time.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am using windows 7.
I have written a simple Spring3 Hello World using Eclipse and successfully run it using tomcat on my computer.
Now I have a Server which runs Linux.
I would like to run the project that I just wrote on my server. It has no GUI or anything of the kind so I can't simply start up eclipse and write the same project on the server.
How do I go about doing that? I am completely new to the whole java and Spring thing, and have absolutely no clue as to how to run my project on the server and be able to view it.
I have searched everywhere online trying to figure out how to put my project on the Server, but it seems like Spring isn't the most noob friendly, especially with its documentation. There doesn't seem to be any explanation on how to take your code from one computer and put it into another and make it work.
There doesn't seem to be any explanation on how to take your code from one computer and put it into another and make it work.
That's right, as it is not often considered "not a programmers job". Its not very related to the framework you're using (Java EE or Spring or whatsoever), instead it's more of an infrastructure thing (related to the operating system and application server that are being used). Nevertheless, it can be very useful to know how the process works.
Generally speaking there are two steps:
Packaging - If you use Maven, you simply run the mvn package command. Or using Eclipse, you can export your project as an WAR-file (Right-click your project, click Export, search for "WAR"). I would advice to use Maven, but that's a bit outside the scope of your question probably. Either way, this step will result in a WAR file.
Deployment - This is a bit harder. The WAR file from step 1 needs to be copied to the Linux server where the application must be ran, and then copied into a special directory where the application server looks for apps. If you're using Tomcat on the Linux machine as well, look for the Tomcat installation directory and find the 'webapps' subdirectory. Other application servers have other procedures / locations, though.
This is under the assumption that Tomcat was already set up for you on the Linux server, and that is running.
This has nothing to do with Spring and everything to do with packaging your application and deploying it in a Servlet container/HTTP server.
Setup Apache and Tomcat (or some other servlet container) on your linux server.
Package your Spring application as a war file (either with maven, ant, Eclipse, or some other build tool).
Drop the war file in the /webapps directory of your Tomcat installation.
Start Tomcat.
Well first you need to get tomcat 'http://tomcat.apache.org/download-70.cgi', and set it up on the linux server you are trying to deploy to.
Then you would export your project as a .war archive in eclipse (File -> Export -> war)
Copy the war file to your server, and copy it into TOMCAT_HOME/webapps
Start up tomcat and you should be able to access the application under localhost:8080/{APPNAME}, so if your war name is myapp.war the url will be localhost:8080/myapp
good luck!
Spring is just a 3rd party open source API. You can do without Spring and still be able to "run" your application on a server.
By "run", this means that your project must be placed in a directory in the server's filesystem, most of the time in the form of a WAR file.
I said most of the time, because if done correctly, you can actually put your project directory inside the server, and it will run without transferring it as a WAR file.
A WAR file is just an archive that has a standard directory structure so that it is readable and executable by the server.
Read the following link on how to package your project as a WAR:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.wst.webtools.doc.user%2Ftopics%2Fcwwarovr.html
And then just copy the WAR file to the TOMCAT_HOME/webapps folder.
Packaging
cd c:/my_project_directory/Web/
jar cvf web-archive-test.war .
Deployment
cd c:/my_project_directory/Web/
scp *.war
your_username#remote_linux_host:/some/remote_directory_where_tomcat_is_installed/webapps/
I am new to TorqueBox. I have created one RESTEasy app which is currently running on tomcat. Now I want to deploy it in TorqueBox.
For that I have created on yml file in apps folder of torquebox. The content of file is
---
application:
root: C:/torqueApp/java/RESTEasyTorque
env: development
web:
context: /hellojava
My problem is when i start server it doesn't deploy my app. What should i do?
Bob answered this on the mailing list, but I'll paste it here as well:
You can deploy pure Java applications on TorqueBox, but you don't use
a torquebox.yml (or *-knob.yml).
To deploy a Java application in TorqueBox, just drop your .war file
into the apps/ directory directly (I'm assuming TorqueBox 1.x)
fwiw, if deploying a Ruby application, you can put a torquebox.yml
inside your application, but the files in app/ would be a *-knob.yml
file, or an archived version of your application with the extension of
.knob.
When we refer to "knobs", we mean either the *-knob.yml, or the *.knob
archives, which are used in the apps/ folder. torquebox.yml is
primarily used within your application's own directory tree.
For Java applications, ignore everything TorqueBox-related, and you
can pretend that our distribution is just like JBoss AS6 (for
TorqueBox 1.x) or just like JBoss AS7 (for TorqueBox 2.x). Our
changes are purely additive, building on top of the JavaEE container
from JBoss.
from: http://markmail.org/message/zhjwhbgxarjsvdz7
For torquebox-2.3.x and above, you need to have jboss-clent.jar is available in your java app's library folder is automatically searches for running JBOSS instance and get deployed to it. However if you need to use Torquebox queues you to bind JBOSS to an IP using runtime JVM options e.g.
JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address=192.168.100.101 -Djboss.bind.address.management=192.168.100.101 -Djboss.bind.address.unsecure=192.168.100.101
Then using JMS API you can use Torquebox queues
We currently have an Java application that can be deployed on clients or run as a shortcut from the server. We have intermittently received ClassNotFound exceptions when running the JAR from the server which looks like Windows dropping the network connection with only part of the classes from the JAR loaded (user opens a different screen then the problem is apparent).
I am currently looking at the Web Start technology to allow us to run a single shortcut.
However the application has several folders it requires to be in the same folder the JAR is launched (for configuration, logs, etc.). These folders will require full access for all users to allow them to write log files. There are lots of configuration files under the configuration folder hierarchy.
The application also requires access to environment user settings (such as getting their user folder). It also requires certain command line parameters (including which folder to use for configuration, log file location, java memory usage, etc.)
Edit
The application also contains a reference to 2 signed JARs. These are:
jh.jar
mail.jar
It looks like these are signed by SUN Microsystems. jh is used for help integration in our application whilst mail is used for email integration.
I have now downloaded the latest versions of these files from java2s.com which do not have the signed equivalents.
end edit
The application is developed in Netbeans which compiles a single JAR file and copies the dependant JARs to the dist/lib folder. I enabled the Web Start functionality in Netbeans for the application and it generates the JNLP file.
Bearing everything in mind is Web Start the way to go for an application like this?
Can you include folders in a Web Start deployment? I could not find anything to do this in the XML structure for a JNLP file.
Cheers,
Andez
Yes, you could use WebStart for this.
Permission:
If you need permission to the file system, you have to sign your jars and put the all-permissions tag in your jnlp.
Arguments:
Arguments can be provided by using the arguments elements in application_desc.
Folders:
I'm don't think you can include folders in the WebStart application, but you could put the config files in a jar and read them from there, or extract them on startup.
ClassNotFoundError:
We have intermittently received
ClassNotFound exceptions when running
the JAR from the server which looks
like Windows dropping the network
connection with only part of the
classes from the JAR loaded
Does not sound plausible to me. per default, all jars will be downloaded before the application starts. If you set "download" to "lazy", the jar will be downloaded when first needed, but I would guess it will be downloaded completly then.
You can provide read-only resources for Java WebStart. Getting the log back is harder. I would suggest looking into a centralized logging solution, using one of the standard appenders in the log framework you use.
For a Java Web Start application it is always advised not to create files or folders in the class path. Recommend user's home directory to store your settings or database files.
I earlier got to create a simple RESTful webservice on my localhost using Eclipse IDE, Tomcat, and JAX-RS libraries.
I am now trying to move the same on to a different unix server which has Tomcat installed. I am not knowing how to get started as in what is equivalent to creating a "Dynamic Web Project" that I do in Eclipse. Do I need to just create a directory myself with all the sub-directories as created by Eclipse? Should this directory be placed in webapps folder in Tomcat container. Should META-INF and WEB-INF also be created by myself?
Where should I put my Java classes?
Can somebody please clarify this or direct me to any documentation about the same.
You need to package your application in a WAR file.
The Sun Java EE 6 Tutorial has a chapter deciated to packaging.
It's pretty easy to export a web application as a war in Eclipse.
Dynamic Web Project (right click) => Export => Web =>war file =>war export dialog
Creation of web application archive - WAR is the solution for your problem,
but take care about all libraries that you need there.
You can easily extract (unzip) WAR file content
and check your project structure and libraries needed
and they will be in WAR's WEB-INF/lib.
Make sure that both Tomcats are set same way,
make sure your code is all OS friendly (users, file paths, permissions)
Always write some test simple code that will run up on app start,
and check all dependencies and libs, system clock, outside world network communication, so you can trace it in web app console or logger easily.
regards