How to correctly deploy a EAR file on Oracle Weblo

2019-02-27 13:31发布

I have an EAR file that I have built from my existing maven web application. I want to deploy the same on the Oracle Weblogic Server Administration Console. To go ahead with that, I logged in to the weblogic conole on http://localhost:7001/console and went to the deployments tab. Previously, I had placed the EAR file in my Oracle_Middleware\domain\mydomain\base\applications folder. In the deployments section, on the console, I get to chose myprojectname.ear and when I select that I get an option to install. So after I install the same, and everything happens properly, how do I be access my index.jsp that was the first screen in my web project? I do find something when I expand myprojectname's tree in the deployment tab-> select the myprojectnameWAR module-> go to the testing tab-> and under test point I see a URL that is present it. but when I click that URL to access it, the webpage that opens up says Error 403--Forbidden. Any help on how I can access the index.jsp on the administrator console?

UPDATE-1

I'd like to point out that I was trying to access the application using the URL http://localhost:7001/projectnameEAR and http://localhost:7001/projectname etc. But just to take a look at it, I tried importing the EAR file into a new workspace on eclipse too see if the index.jsp actually existed in the EAR. But when I import it, all I can see is the WARModule snapshot and the JAR Module. I expected the index.jsp to be there because I obtained the EAR file from an existing web application that had the index.jsp. Or perhaps, it is there but the EAR file does not allow me to see it? Please help regarding how to access the index.jsp page. Im in much need.

UPDATE-2

So after trying everything out, I created a blank maven project in eclipse, built .war, .jar and .ear modules out of it, added the .jar and the .war modules as dependencies to the ear project and ran a maven clean install through eclipse. Further, I took the .ear file and put it in the applications folder and ran the URL to access the index.jsp in the war module, placed at src/main/webapp/ and it worked.

I went ahead and copy pasted the contents of my existing maven project (i.e. the jsps, the js's, to the same src/main/webapp/ directory. I also took all my packages that contained my java classes and put them in the warmodule/src/main/java path. But now if I go to run my index.jsp, I get to see the UI but the chrome debugger shows me a 404 - Not found error when I try to access any of the functionalities(button click etc.) of the page. Is it because I have probably put the classes in the wrong place?

My existing project consists of packages in the existingproject/src/ path and all the other jsps and js's in the existingproject/WebContent path.

Could somebody help me with where exactly (at which path in which of the modules) should I be putting all of my content so that it is accessible properly?

Many thanks

1条回答
Bombasti
2楼-- · 2019-02-27 13:34

Rather than filling up the comments I thought I would write this as an answer and update it as we go.

Have a look at this question. I posted this a while ago when I had a similar issue. Maybe it will help.

Also, here is another link about the weblogic maven plugin. It may be worth trying to use this. In my experience with JBoss I found it more reliable than trying to deploy using the admin console. If nothing else it should give more helpful error messages if there is a problem.

UPDATE:

Ok, so I had a look at my project and here is the relevant part of the EAR pom.xml

<modules>
  <webModule>
    <groupId>com.traintrack</groupId>
    <artifactId>traintrack-web</artifactId>
    <contextRoot>/TrainTrack</contextRoot>
  </webModule>
  <jarModule>
    <groupId>com.traintrack</groupId>
    <artifactId>traintrack-core</artifactId>
    <bundleDir>lib</bundleDir>
  </jarModule>
etc
</modules>

I get the feeling that the contextRoot attribute may be what you need to set. So in my case I would point my browser to http://localhost:8080/TrainTrack. The EAR will then be deployed in such a way that it knows anything with that context root is to be forwarded to the WAR.

Hope that helps, if not please post your pom.xml files and we can go over them, maybe in chat if that suits.

查看更多
登录 后发表回答