how i can find com.ibm.ws.exception.wsexception jar file? - build

i added the admin.jar file correctly to the classpath and to my java application, but these errors still appear 1- The project was not built since its build path is incomplete. Cannot find the class file for com.ibm.ws.exception.WsException. Fix the build path then try building this project.
2- The type com.ibm.ws.exception.WsException cannot be resolved. It is indirectly referenced from required, i understand that there is a helper jar file should be added to my app, but unfortunetely i could not find it.

Two things here:
1) You need WebSphere classes in your build path. The server provides an API/SPI jar specifically for this purpose: WAS_HOME/dev/was_public.jar. It contains WsException, among other classes.
2) You mentioned having "admin.jar" in your class path and Java application. If that means that you're packaging a WebSphere server jar in your Java EE application... don't do that. The server jars are not designed to be packaged within apps, and you run a very high risk of unexpected linkages and class loader hierarchy issues if you try it.
If this is a standalone Java client, not a Java EE application installed on the server, there are thin client jars in WAS_HOME/runtimes that are designed to be used in client application class paths; the server jars in the plugins directory are not designed to be used outside the context of the application server itself.

I agree with Jarid that the proper way is by using the client but if you still need it, then you can download it from https://github.com/NURGALIYESMUKHAMEDOV/Utils/blob/master/CaseSchedule/src/main/resources/wsexception.jar where I found it and used it in my library too.

Related

Trying to load unmmanaged c++ dll in azure

I'm trying to call to my unmanaged dll from my asp.net mvc web app.
when I call this dll from localhost it work just fine.
when publish the app to azure and try to call this dll I'm getting this:
Error:System.DllNotFoundException: Unable to load DLL 'SerenityConfigCodec.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A).
I succeed to call to a simple dll in azure (not mine). According to Microsoft azure documentation.
I use a dependency walker on my dll to know the dlls that I need in azure and add them.
I have some theory that my dll need some extra dll in azure that dependency walker not tell me about them.
Or maybe I need to connect my website to iis and try to use iisreset to cause maybe the .bin folder in azure get into locked at run time and let iisreset unlock it.
Sounds like Azure cannot find your referenced DLL.
Is this DLL added as a Dependency in your project? or as a Nuget package?.
If it's a Dependency there two possible solutions depending on your publishing method:
Add the Copy Local to True if you are publishing using Web Deploy (Right-click > Publish from Visual Studio)
If you are publishing through Continuous Integration and a link to a repository (GitHub / Bitbucket / VSO / etc), add the DLL file to your repository (maybe in a folder especifically for that) and reference it in your project using that folder path.
If it's a Nuget package, it will fail if you are using Web Deploy (unless you set the Copy Local to True), if you are deploying through Continuous Integration, Kudu takes care of downloading all the packages on the deployment process.
I solved this problem by adding the compiled unmanaged DLL file to the managed project, so it would be included in the publish package. Since the added file was either the debug or release DLL I had to manually edit the .csproj file to conditionally copy either the debug or release build DLL depending on if I'm building the debug or release managed DLL. This in turn generates warnings every time I load the project but the builder handles it right. And I need to remember to rebuild the managed DLL to get it to pick up on changes to the unmanaged DLL since it hasn't been doing that for me automatically.
Depending on which version of VS you're using you may need to install the C++ runtime DLLs as well.
The 0x8007045A error indicates that the DLL was found but init failed, while the 0x8007007E error mentioned an a comment to another answer indicates that it couldn't find the DLL to load.

Manager local repository

I come from Java world. I was looking for Apache Maven alternative in C++ world. I think I found the correct project. I have few questions and have not managed to find an answer.
Is it possible to manage local repository. Let's say, I work on 5 similar but different projects and this project share mostly the same dependencies. Will each project have it's own dependencies stored inside each project or is there a "system" wide (per user) local repository where dependencies are stored?
Is it possible to "publish" only to local folder so other project can "see" dependent block or it has to go over bii internet repository?
Or am I wrong - about how bii works.
Looks nice project. Keep up the good work.
Right now, projects act as virtualenvs, each project contains and build its dependencies. This is intended for fast evolving libraries. Imagine you have 5 similar projects all depending on the same library A, version 0. While working on one of those projects you can make a modification to A and publish a new version, an API breaking modification. The other 4 projects will continue depending on version 0, and will not break. When you move to those projects you can easily update their dependencies and fix the breakages.
You can share the same library among different projects straight ahead with sym links if working in linux, not working by now in windows.
For very stable, large projects that can be installed system-wide, it could be more convenient to depend on the installed version. CMake allows this very easily via FindXXX(). You can install system wide the binaries with CMake install, or you can even use CMake scripts or biicode python hooks to automatically download and install system wide those libraries. Check, e.g.:http://www.biicode.com/diego/opencvex, OpenCV is managed with a biicode python hook and installed system wide.
At this moment there is no "local" publication, and if you want to share that way among projects, yes, you have to go over the biicode cloud servers, simply with "bii publish".
However, we are transitioning to open-source. We will probably release first the client code, then we will release a server that could be deployed in-house. Not implemented yet, but a future feature is that this server could act as a proxy to the cloud one, you can publish to the local instance, but read from the cloud one. With a local installation of this server, you will be able to publish locally.

Where can I place external JAR references of a WAR file other than WEB-INF/lib or WL_HOME/server/lib

I have 120 Java Projects exported as JAR files in D:/FC/APP_LIB folder. Now I developed a Web Service (JAX-WS), to be deployed on Weblogic 12c (12.1.2), which refers to those JAR files. I don't think it will be a good practice to add all the JARs into the WEB-INF/lib of the WAR file (and it will continue in all subsequent WARs I develop).
Also, I want to avoid those JARs to be kept in WL_HOME/server/lib folder (default reference) as anytime a change is made in any of the Java Projects will require a deployment in WL_HOME/server/lib.
Is there any way I can give an external JAR(s) reference in WAR or Weblogic without embedding them into WAR?
You can write (and use) a separate class loader to load classes from anywhere.
That being said I suggest putting the jars into each .war file. Disk space and RAM should not be the problem.
If a central .jar is modified (and a bug is introduced), all web apps will fail.
You probably test your web app against a specific version of your libraries. If you update a central .jar, you have to re-run the tests for each application.
Generally speaking you will probably run into problems because of dependencies.
May you need Create Shared Java EE Library or Optional Package. See more in Install a Java EE library and Understanding WebLogic Server Application Classloading.
You can modify the script used to start Weblogic to include the external directory in the server's classpath. See %DOMAIN_HOME%\bin\setDomainEnv.sh (or .cmd if Windows).

How to test Entity classes from another Eclipse project in a Stateless Session Bean within a JUnit Test

So here's what I'm trying to do and stuck at:
I have a shared Eclipse Java project with #Entity (EJB 3.1) classes that is used by a couple of other Eclipse WebApp projects. This project itself has no persistence.xml! The other WebApp projects that use this project declare their own persistence.xml under WebContent/META-INF and refer to the JAR of this project in their persistence.xml using the jar-file tag. Of course the shared project's JAR is added as a deployment dependency in these WebApp projects and is placed under WEB-INF/lib.
Now I am creating JUnit4 Testcases to test Stateless session beans in these WebApp projects. I'm using Apache TomEE 1.5.0 Plus and in the testcase I use a #Before method to start the OpenEJB container in Embedded mode using EJBContainer.createEJBContainer() method. For this to work properly, I have created an alternate test.persistence.xml (that uses a different datasource to an HSQL memory db and creates the tables using forward mapping). I have placed this in META-INF of the src folder and in the #Before method, I set the "openejb.altdd.prefix" to "test" so that the alternate test.persistence.xml is read. All this setup is working.
The trouble is that as soon as OpenJPA 2.2.0 starts, it complains that there are no persistent classes from the shared project! This is because, the jar-file tag in test.persistence.xml refers to a jar that doesn't exist! When Eclipse deploys the other WebApp projects, it creates the JAR under WEB-INF/lib and the actual persistence.xml refers to the jar under that path! However, I do not find any such JAR when running a JUnit testcase.
So how do I refer to this JAR or the classes in the shared project in the test.persistence.xml without making the testcase itself overly dependent on deployment structure or any specific hard-coded path! This testcase will eventually be committed to the repository and hence must be such that any dev checking it out can simply run it.
Any pointers in the right direction would be greatly appreciated!
IMO the easiest and better way to do that is to use Arquillian.
It's far more easier to control the packaging, the life cycle of the container, etc
TomEE also provides a great integration (adapter) with Arquillian you can use.
Check the documentation page http://tomee.apache.org/documentation.html
There is an arquillian section.
You can also check TomEE examples page where you can find a huge amount of small samples including arquillian.
Hope it helps
Jean-Louis

How to setup a self contained project running jetty+sinatra+jruby?

I already installed jruby and gems seems to be installed nicely under jruby's directory so I don't have to worry about that. Now I would like to be able create a sinatra application and run it on top of jetty or some other efficient standalone server? What do you recommend?
It would be important for me that the application source can be modified, it's easy to start and everything needed except java is in a single directory.
Jetty-rackup was just what I was looking for. I don't need to do any jetty specific, just write config.ru and jetty-rackup handles everything.