| |

VerySource

 Forgot password?
 Register
Search
View: 3113|Reply: 18

How to package a Web project into a publishable file (urgent)

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-4 18:30:01
| Show all posts |Read mode
I now have a WEB project.
How to package into a distributable file
Forget the heroes advice, please give detailed steps, thank you
Reply

Use magic Report

0

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-4 18:33:01
| Show all posts
Many ways
1. IDE, MyEclipse
2. jar manual
3. ant
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-4 21:36:01
| Show all posts
Introduction to Java Web Server Selection

实际 In the actual implementation of the javaWeb project, the commercial javaWeb servers that we can use are IbmWebSphere, BeaWebLogic. These two kinds of servers are full-featured and powerful, support all java service container standards, and are suitable for the release of finished commercial javaWeb applications. However, these two servers are commercial servers, which are expensive and require extremely high system resources. In particular, the configuration of Websphere is complex, and it is not suitable for development if it is not used in conjunction with ibmWebsphereStudioApplication. And their different versions have different requirements for javax components such as servlet.jar and jdk. As required by Websphere 3.5, the servlet.jar supports the old version of javax.servlet.http.HttpSession and does not support session.setAttribute () session.getAttribute ().

During the development or learning process, there are many free lightweight Java Web servers for us to choose from, such as Tomcat, Resin, Orion, etc.
They are very easy to use and occupy very few resources, which is suitable for continuous debugging in development; they can also be integrated with integrated development tools such as Jbuilder. According to the actual development situation, JakataTomcat and SunJava are the best combination. When used in conjunction with other application servers, it can support the complete j2ee standard and is widely used. But judging from the common coding problems in Java, Resin is the best solution. From the perspective of use, personally think that Resin is more convenient than Tomcat, and Resin can also be used in combination with IDEs such as Jbuilder6. Resin emphasizes the use of Xml technology, which can be seen from Resin's own HomePage using xtp.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-4 21:39:01
| Show all posts
Resin usage profile

开发 When developing a JavaWeb project using Resin, you need to build your own WebApp. The development and use of ResinCmp / Ejb is not introduced here, only the application

Resin develops common jsp\javaservlet project. Here also talk about the configuration of resin.conf. There are two ways to apply in Resin

Release: First, release in Resin's directory; second, package into War release.

1, published in Resin's directory

查找 Find the <web-app> tag in resin.conf, this tag represents a web application.

In the tag, the id attribute indicates the web path of the application. Such as <web-appid = '/ test'>, it means that the application should be used when accessing on the Web

Http: // hostname / test / to visit. The app-dir attribute indicates the actual path of the application. Such as

<App-dir> d:\resin\doc\test </ app-dir> means the application is under the d:\resin\doc\test directory. The default value is below the root and id

A directory with the same name. Resin can be configured with 3 types of error-page: 404 error is the file cannot find the error page; Exception violation page; cannot connect

Java engine page. They can be set like this separately.

404 file not found page

<Web-appid = '/ app1'> <error-pageerror-code = '404'location =' / file_not_found.jsp '/> </ web-app>

Exception page

<Web-appid = '/ foo'> <error-pageexception-type = 'java.lang.NullPointerException'location =' / nullpointer.jsp '/> </ web-app>

Can't connect to srunServlet engine error page

设置 The settings on this page are irrelevant to the application and belong to the server settings.

<Http-server> <error-pageexception-type = 'connection'location =' / missing_file.html '/> </ http-server>

Classpath settings

See the following statement:

<Classpathid = 'WEB-INF / classes'source =' WEB-INF / src'compile = 'true' />

The value of the id parameter indicates the storage path of the compiled class in the classpath; the value of the source parameter indicates the storage of java source code in the classpath

Path; the value in compile may be true or false, indicating whether Java source code is automatically compiled by Resin's srun. Classpath settings

Generally related to the use of javaBean or Servlet. The value of id indicates the root of the compiled package of javaBean, and the value of source indicates

根 JavaBean java source code stored in the root. Servlet is the same.

Servlet settings

See the following statement:

<servlet-mappingurl-pattern = '*. xtp'servlet-name =' xtp '/> <servlet-mappingurl-pattern =' *. jsp'servlet-name = 'jsp' /> <servlet-mappingurl-pattern = ' / servlet / * 'servlet-name =' invoker '/>

Generally is to specify those that need to be parsed by srun. For example, here, change * .jsp to * .jss, the others remain unchanged, then as long as you encounter

* .Jss files are treated the same as the original * .jsp. Through this you can specify the engine for parsing, such as the following configuration:

<Servlet-mappingurl-pattern = '*. Xtp'servlet-name =' com.caucho.jsp.XtpServlet '/>

In servlet, you can also specify servlet. Such as

<Servletservlet-name = 'hello'servlet-class =' ​​test.HelloWorld '/> <servlet-mappingurl-pattern =' / hello.html'servlet-name = 'hello' />

有 There is an important parameter case-sensitive in servlet-mapping. If it is on windows, it is best to configure it as false, ignore the case, from

But the agreement with windows.

Session configuration

See the following configuration statement:

<session-config> <session-max> 4096 </ session-max> <session-timeout> 30 </ session-timeout> <enable-cookies> true </ enable-cookies> <enable-url-rewriting> true < / enable-url-rewriting> <file-store> WEB-INF / sessions </ file-store> </ session-config>

Session-max: the maximum number of sessions session-timeout: the session expiration time, in minutes.

Whether cookies are allowed: refers to whether cookies are used in the session. If cookies are used, the browser must support session to use.

It is recommended to change to false when you do this. enable-url-rewriting and enable-cookies are generally used together. If enable-cookies is false,

Enable-url-rewriting should be set to true.

File-store: This configuration indicates whether the server stores the session as a file on the server. If you comment this out, then in your

序列 The WEB-Inf / sessions directory under the web-app directory does not store the serialized session object. Session also has jdbc-store configuration, corresponding

I saved the session permanently in the database through jdbc. In fact, it is the physical implementation of saving and reloading the serialized session variables. The session also supports the setting of multiple servers.

Set by tcp-store parameter. Because it involves the problem of load balancing, it will not be described in detail here, but simply write an example:

<Http-server>

<Httpid = 'a'port = '80' /> <srunid = 'a'host =' host-a'port = '6802' />

<Httpid = 'b'port = '80' /> <srunid = 'b'host =' host-b'port = '6802' />

Host <hostid = ``> <web-appid = ''>

<Session-config> <tcp-store /> <always-load-session /> </ session-config> </ web-app> </ host>

</ Http-server>

This example indicates that the session is passed in tcpring mode.

Temp-dir settings

Temp-dir refers to the temporary directory of the application. This is the directory used in javax.servlet.context.tempdir. Model recognition is the application directory

Your WEB-INF\tmp directory.

The above settings can be set in the <web-app> tag pair to control the settings of a web application.

2, packaged into War release

Here is how to publish the JavaWeb application that has been packaged into War under resin.

In fact, this is the simplest and clearest good method. In j2ee, all projects are packaged as ear releases. Among them, Web applications are packaged into

War, the ejb application is packaged into a jar. In resin, these can be deployed directly. Here I only introduce the deployment of Web applications packaged as war.

In resin.conf, look for this: <war-dirid = 'webapps' />. He said the path where the war file should be copied. This refers to relative

Based on the installation path of resin, the above setting means d:\resin\webapps. Just restart Resin. Resin will take the war from

Unpack it to the webapps directory. You can see something like this in the command console or stdout.log

[2002-04-2709: 56: 21.680] statement of initializingapplicationhttp: // haitaiserver: 8080 / rwtest. This one

Indicates that the web application is installed automatically. As long as this application is a j2ee-compliant web application, there should be no problems. Through the road shown above

You can access this application through the path. If you browse to d:\resin\webapps\rwtest, you will see that Resin has generated rwtest for you

Directory, below are META-INF and WEB-INF and your own JSP\servlet file and directory. It is fully consistent with the structure of j2ee. You can

建立 Create a new jsp\servlet in the rwtest directory, which can also be compiled and parsed and run. In practice, you can use Jbuilder

Or Ide tools such as WebSphere for integrated debugging and packaging are very convenient.
Reply

Use magic Report

0

Threads

13

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-1-5 00:39:01
| Show all posts
tomcat too
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Unknown

Post time: 2020-1-5 12:09:01
| Show all posts
You can publish your application as a war package directly.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-5 13:54:01
| Show all posts
Agree upstairs, pack it and deploy it
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-5 14:30:01
| Show all posts
It is not enough to use a compression tool. Select the zip format, write the name as ***. War and put it on tomcate.
If it is a jboss server, it is a little different. It must be marked as **. Ear, and there is a **. War under ear.
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-6 20:57:01
| Show all posts
MyEclipse: TOMCAT-export to WAR, JBOSS export to EAR; the oldest way to manually compress, change the suffix
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-7 20:54:01
| Show all posts
Everyone is right
I want to know how to manually package the project into .war
Forget advice !! Thank you !!!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list