A project that was developed using Jbuilder+weblogic (named Tsterp) was not familiar with the WebLogic and JBuilder, and the working principles of both were not well understood, Only know that the application of WebLogic can be developed very conveniently under JBuilder, until later, when I want to migrate the project to Tomcat, I find it always 404. At that time, it was strange to think that there was a problem with Tomcat configuration, because of the unfamiliar with Tomcat, and finally nothing.
Recently got this project, the development tools have been converted to Apusic Operamasks, and this project was created as a standard Apusic project. And WebLogic is too slow, just want to migrate the application server to Apusic, found in the apusic under the same 404 error. At this time found the report of the 404 error, the browser's address bar has not been the application of the name (TSTERP), but directly "address: Port number/page", Strange. How did the project name suddenly go out? Do you mean to set this project as the default project? The project is configured as the default application under Apusic by the project as the default Apusic of the startup project, and can be accessed normally after startup. It seems that there is a problem with the path somewhere. About setting the default application method under Apusic, as follows: First, if the application is deployed under Apusic's default domain MyDomain, you will need to delete this domain default application. The default application is removed under%apusic_home%/domains/mydomain/applications, and then a new Meta-inf folder is created under the application root directory. Folder to create a new Apusic-application.xml file, the contents of the file are as follows: <?xml version= "1.0" encoding= "UTF-8"?> DOCTYPE apusic-application Public "-//apusic//dtd apusic application 4.0.2//en" "http://www.apusic.com/dtds/ Apusic-application_4_0_2.dtd "> <apusic-application> <module uri=" "> <web> <context-root> /</context-root> </web> </module> </apusic-application>
Because when you create a new project, you are creating a standard Apusic project (that is, an ear project that specifies the application server as Apusic), so you have created it by default in the root directory of this project, and you only need to modify the contents of the Apusic-application.xml file as shown above.
Note: If you do not remove default, two default applications will conflict, resulting in the system not starting properly.
Now that you know what the reason is, find other solutions, carefully look at the original code, found that there are many calls to address the location of the page directly written by the relative path, and this path is based on the server default is the current application of the situation, did not take into account the current application is not the default situation. At this point, you simply add Request.getcontextpath () to the context path in the filter and several related pages before the path. After you change the path of several address calls, and then access the application, there is no longer a 404 error.
From this, it is also found that due to the level of limited and lack of related accumulation, wrote some of the flexibility and portability of poor code.
In addition, look at the original use of Jbuilder+weblogic when the project path, there is a file called "Weblogic.xml" in this file, there is a named "Context-root" item, It is estimated that the function of this item is to specify the default application under WebLogic.
Having said the above questions, I took a look at the Application.xml file under the opermasks automatically generated Meta-inf, which reads as follows:
<?xml version= "1.0" encoding= "UTF-8"?> <application xmlns= "Http://java.sun.com/xml/ns/javaee" Http://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation=" Http://java.sun.com/xml/ns/javaee http:// Java.sun.com/xml/ns/javaee/application_5.xsd "version=" 5 "> <description>ebserp</description> < display-name>ebserp</display-name> <module> <web> <web-uri>web.war</web-uri> < context-root>tsterp</context-root> </web> </module> </application>
The "Web_uri" in this file is the value of the URI of the "module" item of the automatically generated apusic-application.xml file. In this application cache%apusic_home%/domains/mydomain/deploy/tsterp/tmpfiles path, there is a directory named "Web.war", this directory is the corresponding application.xml file The value of "Web-uri" is named "Web.war" because the name of the Web module is defined as "web" when the ear project is created. In this domain, another ordinary Dynamic Web project (webwindtest), in the Deploy directory, directly on a directory named "Webwindtest.war".