Missing websphere.jar when migrating project from WAS4 to WAS7 - websphere

I have been assigned a job to compile an old Websphere(WAS4) project, so we can find out which parts of it need to be changed for the project upgrating( to WAS7).
But when I was trying to fix the jar errors, wesphere.jar is missing!! And WAS7 installation path never hava this jar anymore, searching google failed. And I don't like to install older WAS again to just get this jar.
please anybody can help with this, providing an WAS4 version webspere.jar???
TKX in advance!

The jar file itself isn't important, the classes within it are. I don't recall what was in websphere.jar, but there's a good chance that what was is now in j2ee.jar. In fact, if your code isn't using any WebSphere-specific extensions, there's a good chance j2ee.jar is the only jar from WebSphere that you'll need for compiling.
But you should be able to see what specific classes are being complained about by the compiler and if necessary search for those by opening the jar files in like WinZip.
(Keep in mind that the larger changes are the changes to J2EE and Servlet specification levels.)

Related

Maven in Eclipse?

I am a total beginner at maven, I have read about it online but I am still confused how it can be used. I have eclipse Oxygen version installed and when I open projects I can see maven project option is already there. I was even able to create a maven project using YouTube tutorial. But now then I saw popular plugin called m2eclipse but I am not able to comprehend why is it actually used; when my application ran without it.
I am learning maven to get started with spring boot but I am finding it really overwhelming where to begin with, and many of the tutorial sites state to download maven (But maven already comes along with eclipse?)
Please explain.
Apache Maven is a build tool - a tool for compiling the source code of a project into a program that you can run (for example a jar file, or a war file that can be deployed on a Java EE application server). Besides automating all the tasks for building a project, it also gives you a standard way to organize your project and to keep track of dependencies (libraries that your project needs).
Why do you need such a tool?
When you write a small program that consists of one, or maybe a few source files, it's easy enough to compile it by hand on the command line, by directly using the Java compiler javac that comes with the JDK.
But when your project becomes more complex, and you have hundreds or even thousands of source files in multiple modules, it becomes really hard to keep track of everything and cumbersome to compile the files using javac. If your program needs libraries, it becomes even more complex, because you have to make sure that all the libraries are on the classpath, and some libraries need other libraries, which also have to be on the classpath.
A tool such as Maven helps you to compile all the source files in the right order and to keep track of all the libraries. Maven can automatically download libraries from the web and add them to your project, and downloading everything and building the whole project can be done with one simple command such as mvn clean package.
Spring Boot is part of the Spring Framework, which is a huge framework with tons of useful functionality for developing projects in Java. A Spring Boot project typically needs dozens of libraries, and it would be very hard to use if you'd have to keep track of all those libraries by hand - so that's why it uses Maven to manage all of this for you.
A Maven project is configured using a file named pom.xml - in that file, you describe your project and you put a list of libraries that your project needs. When you build your project, Maven will read the pom.xml file and figure out automatically what source files need to be compiled, and what libraries need to be downloaded.
m2eclipse comes preinstalled in Eclipse (at least when selecting "Eclipse for Java developers" or "Eclipse for Java EE developer"), thats why you were able to use Maven by default.
Still you probably want a command line Maven, because that's most likely how it will eventually run on the CI server, sometimes Eclipse Maven installation can produce different result than the command line install.

How can I find the root cause of my never ending maven dependency hell?

I have a maven java project in Eclipse IDE, and it needs to communicate with components on a weblogic server. When I first coded this, it worked without importing too many jars. However, I needed to make my project a part of a bigger assembly, and now my dependency requirements have gone out of control. I am still a little new to maven, and how it integrates with eclipse, but I've found that most of my ClassNotFoundExceptions points to classes that do exist, but with slight variances in path. See image below.
I suspect that I have imported a wrong library somewhere in the beginning of my dependencies, that now seems to be dependent on a great big tree structure of Classes that actually already exist, but with another path, and I'm stuck retrieving each of them individually, when they are already there...
Just look at the image: I have com.sun.xml.internal.bind.marshaller.SAX2DOMEx.class, but not com.sun.xml.bind.marshaller.SAX2DOMEx.class
Am I right in assuming that I am trying to fix symptoms, when I should focus on fixing the cause? If so, how can I retrace my imports, and find the root cause, in other words where I start importing the wrong jar?
#KjetilNordin,
You wrote:
I've found that most of my ClassNotFoundExceptions points to classes that do exist, but with slight variances in path
This suggests that somewhere along the way, one or more of the jars you depend on has 2 conflicting versions, between which the class moved between different packages. Maven's dependency resolution mechanism is resolving the jar to the version where the class sits in a different package from where you expect.
Run mvn dependency:tree on your project to see the entire hierarchy of transitive dependencies organized so you can track what depends on what. You'll likely see your jar come up in multiple locations, and presumably the wrong version is getting precedence in terms of Maven version resolution.
Next decide which version you want to go with.
Finally, add a <dependencyManagement> block in your pom.xml file to force the version to match your desired version.
Hope that helps.

I am getting java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext

I have added spring-web.4.0.jar in classpath. It contains the class - org.springframework.web.context.WebApplicationContext. but when I try to run it in eclipse it shows me an error : org/springframework/web/context/WebApplicationContext.
How to resolve this error?
Choosing "Clean..." from the server contextual menu helped me get rid of this problem.
Try clean and rebuild your eclipse project, because sometimes eclipse gets out of date.
Alternatively, if this doesn't help, you need to verify that the runtime path indeed points to the correct jar, and that the jar does indeed contain the WebApplicationContext.class and is readable.
To see the runtime path, use the debug view (Window - Views- Debug), right click to view properties.
Find the jar and open it with a normal zip viewer to see if the file reads correctly.
The root cause of this problem can be almost literally anything, but here are a few weird things to check:
Maven dependencies with test or provided scope that should be normal scope
Spring XML files have schema versions that don't match framework version (3.0 or 4.0)
Spring XML references "https://" instead of "http://" or vice-versa (depends on version)
web.xml file containing ${} references not compatible with chosen web server
Conflicting version of very core libraries such as Jackson, Servlet API, spring-*
Misconfigured or missing or incompatible loggers: slf4j, log4j, jcl
Mixing of old and new: jdk version, spring version, dependency versions, IDE, server
Maven dependencies not showing up in Deployment Assembly (this one went away with upgrades)
Stale or locked jarfiles... may require a reboot, tomcat "Clean..." not enough
Missing required -D or environment variables
My application ended up with several of these all wrong one after another.
The exception is misleading. Setting a debugger breakpoint on the exception sometimes helps.

fiji plugin : imgOpener exception (scifio class)

I'm using Fiji for the first time, I need to open an image as a FloatType so I followed the example found here http://fiji.sc/wiki/index.php/ImgLib2_Examples#Example_1b_-_Opening_an_ImgLib2_image but I get this error:
WARN: Ignoring non-Maven build directory: /home/utente/workspace/my_project/bin
Exception in thread "main" java.lang.IllegalArgumentException: No compatible service: io.scif.SCIFIOService
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:222)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:176)
at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:153)
at org.scijava.Context.<init>(Context.java:200)
at org.scijava.Context.<init>(Context.java:127)
at org.scijava.Context.<init>(Context.java:116)
at io.scif.img.AbstractImgIOComponent.<init>(AbstractImgIOComponent.java:65)
at io.scif.img.ImgOpener.<init>(ImgOpener.java:99)
at SGP_db.StartingJFrame.getGn(StartingJFrame.java:216)
at Plugin.SGP_deblurring_boundary.main(SGP_deblurring_boundary.java:58)
Can't undertand why I get this error, any ideas?
Thanks,
sara
It is almost certainly a build path issue in Eclipse. Are you using the M2E plugin to manage your projects?
If you are not, or aren't sure, please follow the directions on the Fiji web site at:
http://fiji.sc/Developing_ImgLib2#Developing_ImgLib2_with_Eclipse
I would strongly suggest not to manually juggle JAR files in non-Maven Eclipse projects. The Eclipse Maven integration will make your life much easier. For more details, see:
http://fiji.sc/Maven
I've solved importing the ImgOpener class from imglib2.io
Please note that imglib2-io no longer exists; the up-to-date way to access the ImgOpener is to use the io.scif:scifio library instead. If you are basing your work off of the ImgLib2 Examples, please note that you can grab the source from GitHub, which includes a Maven POM with the correct dependencies specified. Start from there, or from the minimal-ij1-plugin project if you need to use ImageJ 1.x routines as well.

Weblogic fastswap webinf/lib modules

We user maven to build the project and have a war module with dependencies packed into webinf/lib as jar files. The jar files are themselves configured as individual maven modules. We would like to enable fastswap for all the modules as redeploying the entire application takes a lot of time
From what I have gathered I understand that weblogic fastswap does not monitor webinf/lib dir. And also the option will be to explode the jar files into webinf/classes dir for fastswap.
In case the above scenario (exploding jars into classes folder), is it safe to do this or are there any adverse effects which can occur by following this.
I would like to know whether there is an alternative/preferred way to do this.
Any help would be very much appreciated.
WebLogic Server version: 10.3
Note: This will be done only in dev and prod the dependent modules will be again packaged under webinf/jar
Thanks.
--
Regards,
guru
As you obviously already know fast-swap doesn't solve your issues. I would suggest looking at some redeployment solutions (e.g. JRebel) ...

Resources