How to get Eclipselink samples to work: "student" and "mysports" samples - jpa

I've been trying to get the following Eclipselink samples to work, with less than 0% success:
A)
http://wiki.eclipse.org/EclipseLink/Examples/JPARS/Simple
B)
git://git.eclipse.org/gitroot/eclipselink/examples/mysports.git
Both samples are quite recent and should work "out of the box". My results:
A) starts and deploys on glassfish, but application is totally unresponsive
B) does not deploy, since glassfish does not find the data-source mentioned in the persistence xml's: java:global/mysports
For both I tried to get information on how they are supposed to work, but after two days of searching for documentation, I can safely state: there is literally NOTHING documented.
For A) I am totally clueless, there is nothing to configure for this sample, but the provided URLs for interacting with the REST service always return with 404 and no log or error message whatsoever.
For B) Beside the broken data source (I guess my fault), I tried setting default JDBC data-sources, to see if at least the REST service itself works: it looks dead, I get exceptions when opening the sample JSF pages (the reference variables inside the pages all resolve to NULL).
Anybody ever tried to actually run these samples? I am totally frustrated after many hours of being far away to anything testable...
Maybe some questions as a starting point:
- How does the JPA-RS get registered in the appserver? how do I tell if it was at all? And which URL it maps to?
- How does this magic "java:global/mysports" data source work?
- The maven configuration acts funny, I couldn't get any of the two samples to properly debug (no breakpoints were hit at any point in time). Any ideas?

If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above:
org.eclipse.persistence.antlr.jar
org.eclipse.persistence.jpa.jar
org.eclipse.persistence.asm.jar
org.eclipse.persistence.jpa.modelgen.jar
org.eclipse.persistence.core.jar
org.eclipse.persistence.oracle.jar
javax.persistence.jar
org.eclipse.persistence.dbws.jar
org.eclipse.persistence.jpa.jpql.jar
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\your_domain\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish.

These are both advanced examples, unless you are looking for these specific features, I would recommend starting out with simpler examples.
There are many EclipseLink JPA examples documented here,
http://wiki.eclipse.org/EclipseLink/Examples
Most of the examples are still in SVN here,
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/
For documentation on the JPA-RS examples see,
http://wiki.eclipse.org/EclipseLink/Examples/JPA#JPA-RS
Try adding question to the example's wiki discussion page if you are having specific problems.
The MySports example is very advanced. Unless you are looking for extendable entities and multi-tenancy, I would not recommend starting with this example.

To add to James' comments, if you are specifically interested in JPA-RS, perhaps these additional comments will help. I also recommend asking questions on the wiki discussion page.
JPA-RS gets registered in the appserver by the existence of the org.eclipse.persistence.jpars_[version].jar in the WEB-INF/lib directory. This jar contains the web-fragment.xml which is what defines the JPA-RS service. You will know if it was deployed if the following URL pattern returns persistence unit metadata:
http://<server>:<port>/<applicationName>/persistence
Some additional documentation for JPA-RS:
- http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa001.htm
- wiki.eclipse.org/EclipseLink/Development/2.4.0/JPA-RS/REST-API
One thing that will help you debug is to view the Glassfish server log. If you are running in Eclipse, right click on your Glassfish server in the Server view, go to Glassfish->View Log File, which will open the server log in your console view. This will show you what is happening with deployment, and will alert you to any errors. Also be sure to double check your URLs.

Ok, ladies. A friend of mine had the brilliant idea of forcing ALL logging on eclipselink-jpars library (by setting this value in every single file we could think of) and indeed we found an exception that is FOR NO GOOD REASON hidden in the lowest log level:
javax.xml.bind.PropertyException: name: eclipselink.json.include-root value: false
Whatever that means, but that again convinces me that I will not use this feature/lib for the time being. An exception should be visible on all log levels, especially if I go down to FINE (as stated in the samples!)! I almost lost three days just because of this.

Related

Deploying solution with mulitple windows forms projects

I apologize if this has been answered in another post, I can't seem to find it if it has. Anyway, I have built a back end utility for a fellow streamer friend of mine but I can't seem to figure out what I'm doing wrong when it comes to deploying it. This is a project that will be expanded on in the future, and possibly have more windows form projects. So here is what I am running into (With Pictures):
Here is my solution explorer with the projects:
When I go to build the deployment I've tried making all the projects "outputs" and got this error. Thinking it was there were too many Project Outputs I changed it to where the startup project would be the output and the others would be either source or content files. Still got these errors. Here is the File System Setup:
And when I go to run the build to create the deployment, here are the errors I receive:
I don't know/don't see what I am doing wrong here and would very much appreciate a point in the right direction. Thank you all so much in advance.
Check your updates. I remember there is an option to review or check the status of latest updates.
I found this article about that issue but it looks like a general error with updates or the installation
It is not too long but maybe it does not help. I hope it helps, good luck

How to add logging to an existing Eclipse plugin to work in 2019-12?

I'm trying to fix a problem in an Eclipse plugin at https://github.com/davidmichaelkarr/e4macs . The repo is a fork of the original application, which is now abandonware.
I have a couple problems with this, but I'm going to limit the scope of the question, hopefully making it simpler for someone to provide an answer.
The main problem I'm having with the plugin is that some operations (the operation "split-window-vertically" in particular) simply do nothing when I execute them. This didn't used to be the case. In some recent versions of Eclipse, this was working fine. It stopped working about 2019-09.
What I want to do first is add log statements that show it's at least getting to the handler method. I've concluded that I don't know how to add logging to an Eclipse plugin. The existing code for the plugin doesn't do any logging, so I don't have an example to go by. I've searched the net for documentation on how to do this, but all the articles I've found are either incomplete or just don't work.
I know of at least one handler that IS working properly. I added what I thought was the correct logging code to that handler, and it never appeared in the ".metadata/.log" file, so I assume that that was not the correct way to do logging.
I saw a reference to using "Activator.getDefault()", but that posting didn't say what the FQCN is, and all the completion offerings I found didn't have a "getDefault()" method.
Update:
I added something like the following to two classes:
private ILog logger = Platform.getLog(<ContainingClass>.class);
And then in a method in each of these classes, I used logger.info("message");
I ran this in my debug instance and tested the operations in both classes. The log messages appeared.
I then uninstalled the plugin from the main installation, then built the plugin in my RPC instance, then reinstalled the plugin in the main installation, from the local update site defined by the "...Update" project.
I then tested both operations, and I saw nothing in the log.
I may have solved my logging problem at this point, but I'm still having some sort of problem with deployment. I have a feeling that the process I went through to reinstall the changed plugin is not working.
To get an activator with a getDefault() method you must specify that the plugin contributes to the UI when you create it and that you want an Activator to be created. This should create an activator class extending AbstractUIPlugin and with a getDefault() static method.
In any plugin you can always use:
IStatus status = new Status(....);
ILog log = Platform.getLog(getClass());
log.log(status);
to log a status object.
Status has numerous constructors. A simple one just to log a message is:
new Status(IStatus.INFO, "plugin id", "message");
Platform is org.eclipse.core.runtime.Platform
Status is org.eclipse.core.runtime.Status

Guidance for diagnosing {"message":"An error has occurred."}

Can someone point me in the direction of instructions for working out what has gone wrong with my Mobile Service App. It was working fine with a couple of simple tables. I then extended the data model using code first and migrations and now all I get when enter a url such as:
http://xxxxxxxx.azurewebsites.net/tables/firm?ZUMO-API-VERSION=2.0.0
is
{"message":"An error has occurred."}
I have now removed all new tables/data objects and controllers so that only one exists for a single table called "Firm" which has a single string property. I have switch OFF authentication/authorization in the Azure portal but I still get the same error.
I have tried both CustomErrors=Off and CustomErrors=RemoteOnly in the debug web config. I am publishing a debug build.
I have tried switching on logging and remote debugging etc in Azure but am unable to work out what is broken. I have tried remote debugging with a break point in my FirmController GetAllFirms method but error occurs before that point.
How do I get more useful information about what the problem is?
I have managed to solve this one myself. In fact now that I know what it is the answer was staring at me from the build output.
The issue was that when extending my model I referenced a .NET Standard 2.0 class library containing some enum definitions that are common to both the backend and the client.
I did not notice the warning that some assembly versions needed binding redirects added to web config. Double click on the warning message and VS2017 will add the necessary entries to web.config for you.
For more details see here on github.
I never did manage to get behind the {"message":"An error has occurred."} though. I solved this by rebuilding my backend project one step at a time and it was after adding the reference to the .NET standard project than I noticed the "Consider app.config remapping of assembly ..." messages in the build output window.

Accidentally published CompositeC1 with precompile on

I accidentally published Composite C1 from Visual Studio with "Precompile during publishing" when I first set it up and have now come to realize that several plugins do not work with precompile turned on. Unfortunately I have no idea how to reverse this. I've tried several things to no avail. I usually end up with a 500.0 error. If I go to the admin interface everything is working properly, and I can even preview the pages, but from the customer side all I get is a 500.0 error.
Of course I could republish from the Visual Studio project I have, but that project has the default template on it. I've tried copying what appears to be changed on the server to the original project but I end up with a 500 error. I've tried removing all the precompiled stuff on the server but I end up with a 500 error. I'm pretty lost.
At this point I'm willing to do anything. Is there a doc explaining how to copy the content to a newly downloaded copy, kind of like an upgrade doc but "side-grading"? I am using the most current version at the time of writing this 4.2 Update 1
Thank you
Solved use the PackageCreator suggested by wysocki's answer. It was not exactly straight forward to create the package. The errors can very cryptic at times. So here are some of the issues I encountered and how I got past them:
wysocki was correct to suggesting starting with a bare bones installation even though my original project was started with the Venus theme. I tried both ways.
I encountered issues with the MasterLayout and the Page Template Features which are currently not supported by the PackageCreator, although they may be supported in future versions. The solution was to add the missing elements to the fresh C1 project from the original C1 installation in the App_Data/PageTemplates and App_Data/PageTemplateFeatures folders.
A few times I ran into an issue where I added the same page or function twice to the PackageCreator. This was obviously my fault, but it should be mentioned that you can add the same site element twice which throws and error on import. Make sure you are careful to only getting one of each when creating the package to be exported.
If you are getting and error and it uses and Id like "4061397b-ee9e-4512-984d-f2b2d41eb654" I've found that it was very helpful to extract the zip file you are trying to import and then search the extracted folders for that Id. The lines with the Id usually have more information on them that will help you to identify exactly what content page or whatever the error is being generated from.
If you are using installed packages in your project like SimpleSearch for example, make sure you don't add it's functions to the PackageCreator. Install them separately.
I had an issue where I somehow had an element in the Data section that didn't have a "type". The error simply "The type cannot be empty". This was obviously tough to find so I suppose the lesson is, less is more. If you think your project might have a few elements that are unnecessary, don't add them at first and see if the project you import them into complains about missing them. It's much easier to troubleshoot missing elements than it is to figure out which element is causing the issue that you really didn't need.
Is there a doc explaining how to copy the content to a newly downloaded copy
You can try and export content / templates / anything else related to a "package" via Composite.Tools.PackageCreator.
Its latest version gives you quite a lot of flexibility in what you can export ("package") - please its user manual.
Once the package is made and downloaded, you can go on and install it on a new website. If you export / import a lot of content / templates etc, it makes sense to have a "Bare Bones" site as the new one.
All the starter sites like "Neptune", "Venus" are installed as a bunch of packages in specific order during Composite C1's initial setup.

Eclipse messing up excluded filter?

Eclipse is setting constantly excluded filter in build path config to **, which causes resources to be excluded from deployment. Anyone aware of this issue, and how this can be prevented? Any thoughts?
How i said in the comments of your question i did not verify any of both approaches and i only think/hope they could lead to a solution rather than i know it exactly.
First approach:
Since you handle the entire process of compilation and packaging via Maven i assume you collect required ressources with Maven only (and that if you filter out certain ressources you would do that with Maven only). In that case i would try to disable all of the eclipse filters to be included into the build path - which i would expect as the behaviour if you disable this option:
(i once experienced eclipse added a "*"Filter to my Type Filters hence i wasnt able to find anything on typesearch Ctrl+Shift+T anymore - so my hope is a similar behaviour when it comes to your filter-all-resources filter"
Second approach
Actually i think that this approach will only affect the view rather than the build/ deployment process but hey its eclipse - you just never know so i guess its worth a try:
In the following screen you should see any filters known by eclipse - i assume you will see the . Filter there as well and be able to unselect it:
I guess its worth a try - good luck ;)