FileNotFoundException when deploying in local Oracle WebLogic - java

I need to create a local environment to deploy an EAR, which is currently in production.
By documentation, it needs:
Java EE 7
Oracle WebLogic 12.1.2
Maven
Installed everything fine and configured, but this is my first time with Java Enterprise and WebLogic. I downloaded WebLogic from the official website (the 12.1.3 version, which is the only one available for a development installation). Executed all scripts to create a local domain, realm and server. It starts fine.
So, I proceeded generating the EAR within the source code, using mvn ear:ear and created the package.
Connected to localhost:7001/console and logged in, went into the Deployments Control page and clicked in install button. Browsed the EAR and deployed without changing any default configuration. It leads me to an error:
java.io.FileNotFoundException: class path resource [env.properties] cannot be opened because it does not exist
I thought it was a file missing inside the EAR package, but I opened it with both Eclipse and WinRAR and the env.properties file is present, in the right path. So I tried deploying the EAR package that is currently in production, but it still gives this error.
At this point, I think it's some WebLogic configurations I missed. Am I right? Where should I eventually check?
I can NOT share any code snippet, I'm sorry.

We still have to understand if it's like this by choice, but the WAR file inside the EAR actually didn't have the properties file. It was sufficient opening it with WinRAR, put the file in the right path and re-deploy it.
So, just to say, WebLogic had no missing configurations. The downloadable development package seems to have everything configured.

Related

Eclipse not loading WAR file

I received some java code and a WAR file for a web application that I need to test.
My overall goal is to be able to test the web application functionality and potentially make modifications to the code if need be.
I seem to be stuck on correctly loading this into eclipse.
I grabbed the WAR file and did a Import where I attempted to import the WAR file into a (Web -> WAR) project. The first issue was Eclipse was complaining there not being enough memory or the heap size. So I changed the java memory options in the eclipse.ini file. This seemed to resolve the complaining about the memory.
I restarted eclipse and attempted to import the Web - War again now it goes through the process of pretending like it is importing the war file but nothing happens after it finishes.
So overall my questions are
1 What is the correct process to load the war and source code into eclipse
2. Why is Eclipse not loading the war file
If you want to test a WAR file, you must deploy it to a Servlet container. Common Servlet containers include: Tomcat, Jetty, JBoss (which actually uses Tomcat), WebSphere, and WebLogic.
JBoss, WebSphere, and WebLogic are JEE environments, but they each have a Servlet container.
WAR file generally contains compiled version of .Java file i.e. .class file and other web related stuff.
You unzip the .war file with WinZip or similar software, if it contains source code attached, then only you can view or modify the code.ELSE you can do the below steps to run the application.
Install a server e.g Apache Tomcat to your PC.
Start the server from CMD.
Open the server home page.
Deploy your WAR file. Now you will be able to see the Application running.
If you want to modify the code then you should have .Java files inside your war file.

Deploy to Tomcat

How can I deploy a war file to Tomcat in exactly the same way Eclipse deploys to Tomcat, if I configured Tomcat in Eclipse?
Reason for asking is that when I deploy with Eclipse everything works fine (databse connection, log4j ect). But when I manually deploy the corresponding war file to the same Tomcat installation, none of my external resources like database connection, logging to files work!
You can add the external jars to $CATALINA_BASE/lib Read here
Common — This class loader contains additional classes that are made
visible to both Tomcat internal classes and to all web applications

How to redeploy EAR file to Web-Logic without restart server?

I have EAR file (which includes a WAR file and EJB jar file) was deployed on Web-Logic(10.3.6) successful.
Now, I have updated EAR file and I redeploy again follow steps: delete old files on the server and install new EAR file without restart server. Every file have been deployed in Active state. But I got some exception related EJB injection. Then I restart Web-logic, my app is running fine.
What's wrong with the redeploy way?
Thanks in advance for any Help...
Weblogic has an lots of documentation about this topic. Sometimes it's referred to as a "hot deploy" or an "in-place" deploy. In the weblogic admin console there is an option to update an ear file rather than what you are doing with the delete->redeploy method.
Just make sure to update your Weblogic-Application-Version property in the MANIFEST.MF of your ear so that weblogic knows it's a new version. Here are some useful links:
Oracle redeploy documentation
An older but still valid list of steps to hot deploy
That said - the problem you are seeing may be something different and your question will need to be updated with more details if the Oracle docs don't help.

Where is my webapp deployed(From Eclipse to Tomcat 7)

I am trying to deploy my Web application(Dynamic web Project) from Eclipse to Tomcat 7( in Windows). Although the deployment works, I would like to see where exactly(the location) the web app is deployed. I did search for my webapp (named as 'Demo') in TOMCATINSTALLATION/webapps directory. But could not find my application('Demo') there.
Double-click on the Eclipse Tomcat server instance and have a look at the configuration. If you are using the option "Use workspace metadata" then the app is deployed in a path like
<workspace>/.metadata/.plugins/org.eclipse.wst.server.core/tmpX/wtpwebapps/<context>
Not sure about particular Eclipse case, but usually IDE deployment works by dynamically overriding CATALINA_BASE environment variable and setting it to your project output folder. CATALINA_BASE tells Tomcat to search for your wepapps, server settings, etc. in the specified folder.
So answer to your question is that the actual working code sits somewhere in your project's build folder: subfolder build for regular projects or target for maven ones.

Tomcat classloader is not working

I need your help. I am facing unusual problem dealing with Tomcat classloader. I have a WAR and inside the WAR there's a third-party JAR that has native methods. The WAR successfully deployed in a development server for the first time and had been running for about 3 months.
Last week, I did some code refactoring and wanted to deploy the updated WAR, so I delete the old instance and deployed WAR. But now after the redeployment, I always face NoClassDefFoundError. I redeploy the WAR for several times, and the result is same, NoClassDefFoundError.
Oddly, when I deployed the updated WAR in my laptop also use Tomcat, it works fine. My co-worker also tried to deployed in his laptop using Tomcat, it works fine.
I had deleted files inside work directory, but still NoClassDefFoundError appeared. I had turn off the Tomcat, delete the instance on webapp folder, copy the updated WAR again in webapp folder, turn on Tomcat again, but still the error shows up.
What's wrong with the Tomcat in the development server?
You can only register a native library once in the lifetime of a JVM. I suspect that when you updated the WAR, it tried to register the native library again, that failed and that in turn lead to the NoClassDefFoundError. That a restart of the Tomcat server fixed it is consistent with this theory.
If you ship a WAR that contains a native library then the safest course is to restart Tomcat everytime you need to update the app.

Categories

Resources