Strange GWT Error with external jar on server side - gwt

I want to use a external jar (Apache Mahout) on the server side of my GWT Applicatopn.
As far as i know using external jars on the server side shouldn't cause an error. Only on the client side but when i try to run the code i get the following error:
"no source code is available for de.unimannheim.paniscus.server..."
Whats wrong here ?
Please help me i need to solve this for my thesis
Hi guys i created now an collbaorative.gwt.xml where i inherited all classes from apache mahout that are used within de.unimannheim.paniscus.server.collaborative but it's still not working. Sorry i'm helpless whats wrong here ?

I agree with Dusty Campbell, you should not inherit the jar in the *.gwt.xml. The <inherits> tag in the *.gwt.xml specifies gwt-modules which should be inherited. So only client-side-compatible code can be inherited.
Citation from the gwt docs: "<inherits name="logical-module-name" /> : Inherits all the settings from the specified module as if the contents of the inherited module's XML were copied verbatim. Any number of modules can be inherited in this manner"
see also: http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html#DevGuideInheritingModules
My guess is that you (by mistake) use a class from the "de.unimannheim.paniscus.server" package in client-side or shared code. Even just an import statement (import de.unimannheim.paniscus.server.*) will cause this exception.

Related

Ecore EMF PackageNotFoundException

I have to work with a project I didn't wrote myself. It uses Ecore EMF (I have no experience with this) and I can't figure out how to solve this error:
At some point the program loads a .xmi file with this function: org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI()
And this results in this error:
org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'platform:/plugin/Animals/model/Animals.ecore' not found. (file:/C:/Users/model917.xmi, 2, 193)
It seems like the file model917.xmi exists and is not the origin of this error. I think the problem is caused because the Animals.ecore file is not found. In the model917.xmi file I found this statement:
xmlns: Animals ="platform:/plugin/Animals/model/Animals.ecore
So I think the model in file model917.xmi uses another model defined in Animals.ecore which can't be found and causes the error.
I have access to the Animals.ecore file and found out that EMF/ecore uses something like a registry to find such files. So it seems like I have to add the Animals.ecore file to this registry and I found some answers online which didn't work and I run out of ideas what to try next. Can someone give me an easy way to register this file so it will be found? I am using Eclipse if this is relevant/maybe there is an easy way to do it with Eclipse.
Usually, EMF-based softwares should rely on the so-called "namespace URI" (nsURI) of EPackages, which are usually of the form "http://foo/bar/Animals".
"http://foo/bar/Animals" should be registered in the EMF Registry and dispatch depending on your actual runtime situation to a URI that looks like "platform:/plugin/bar.foo/Animals.ecore" (when file Animals.ecore is deployed in an Eclipse plugin for an Eclipse-based application), or "platform:/resource/bar.foo/Animals.ecore" (when file Animals.ecore is deployed in the workspace of the running Eclipse-based application) or even "file:///path/to/Animals.ecore" (anywhere on the filesystem).
Technically you can use any of those URI forms as long as they are correctly resolved at runtime, but you must understand that not all URIs make sense in all contexts, for instance "platform:/" URIs only make sense in Eclipse-based context. nsURIs are supposed to be resolveable in all contexts (thanks to the registry!)
Is your code meant to be running in the context of an Eclipse-based application ? Then the project containing Animals.ecore should be deployed as a plugin, and I am guessing it is currently not.
Is your code meant to be standalone? Then the reference in your xmi file, to the ecore file, should not be of the form "platform:/..." but rather of the form "http://foo/bar/Animals" (the nsURI of the EPackage that is the root element of Animals.ecore)

java.xml.namepsace error - SOAP (Webservice) in Java

I have no experience with WebService, especially SOAP, but I have to deal with it. I work with Java 11 and with the latest Eclipse IDE. In the beginning I read a lot and also developed my own WebService. This service can only calculate the BMI. There are no errors in this service on the server side.
I had the client automatically generated with the Java API for XML Webservices. However, several errors are displayed in the generated classes.
First Error:
"The package javax.xml.namespace is accessible from more than one module: java.xml, jaxrpc"
If I try to fix the error, then there is a new error. Let's get back to trying to fix the bug. In some other forums I have read that in the module information "module-info.java" the "requires java.xml" should be commented out. The error seems to disappear for now, but it leads to two new errors:
"The type javax.xml.namespace.QName is not accessible" and "The type javax.xml.namespace.QName cannot be resolved. It is indirectly referenced from required .class files"
Here are a few code:
module Client {
exports ws;
requires axis;
requires java.instrument;
requires java.logging;
requires java.management;
requires java.naming;
requires java.net.http;
requires java.prefs;
requires java.rmi;
//requires java.xml;
requires jaxrpc;}
Here is a example of the DemolmplServiceLocater where java.xml.namepace are underlined red:
public DemolmplServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
super(wsdlLoc, sName);
}
This is the class DemolmplService.java with the second error and "fixed" first error.
The lost one ist the Build Path from my project.
Among other things I opened a client in Java-SE1.8 project and tried out the client there. There no error was displayed and the method bmi(weight,height) was executed successfully. But I need the project at least in Java 10 or higher.
Can anyone offer me a solution, preferably a step-by-step guide?
I thank you in advance!

How to share a GWT RPC RemoteServiceServlet among multiple client modules / apps

I have several GWT modules and web apps running in Jetty. They each want to use my LoginService RPC interface, so I put this interface and its servlet implementation in a common module. I serve the servlet (LoginServiceImpl) from my root web context, and web.xml exposes it at the url "/loginService". In a another GWT module, to use this service, I had to set the entry point, like this...
LoginServiceAsync loginService = GWT.create(LoginService.class);
ServiceDefTarget t = (ServiceDefTarget)loginService;
t.setServiceEntryPoint("/loginService");
Now, the module trying to use the loginService is called discussions, and I get this error on the server.
ERROR: The serialization policy file
'/discussions/discussions/7B344C69AD493C1EC707EC98FE148AA0.gwt.rpc' was not found;
did you forget to include it in this deployment?
So the servlet is reporting an error that mentions the client (the discussions module). I'm guessing that the RPC plumbing passed the name of this .rpc file through from the client, and the servlet is now looking for it. (?) As an experiment, I copied, the *.gwt.rpc files from the discussions module into the root web context, so the servlet could find them. This did stop the error. But I still get another error:
com.google.gwt.user.client.rpc.SerializationException: Type
'mystuff.web.shared.User' was not assignable to
'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field
serializer. For security purposes, this type will not be serialized.: ...
This class is serializable; it worked before in other modules, so now I'm lost.
What is the right way to use the LoginService from multiple clients modules?
Update:
This error was showing up in hosted devmode, and it went away after a full compile. Maybe this is related to gwt serialization policy hosted mode out of sync . I will update again if I can better reproduce the problem.
See my answer here. The short answer is: you'll need to make mystuff.web.shared.Users source available at compile-time to your discussions module.

Enterprise lib 5.0 not detecting app.config

I have a Solution which contains a Web project and a Class Library project. The Class library project contains Enterprise library 5.0 and app.config. When I try to perform a Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write, I get the following exception:
Resolution of the dependency failed,
type =
"Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter",
name = "(none)". Exception occurred
while: while resolving. Exception is:
InvalidOperationException - The type
LogWriter cannot be constructed. You
must configure the container to supply
this value.
----------------------------------------------- At the time of the exception, the
container was: Resolving
Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,(none)
If I move all the class files to the web project and have the Enterprise library configuration in the Web.config, everything works fine. I guess the issue is that the Enterprise library is not detecting the app.config which contains all the configuration.
Kindly help me with this regard.
Thanks in advance.
.NET dlls don't have config files. AppDomains do. You cannot put any configuration in a dll's "app.config" file and expect it to get automatically picked up. This is the way .NET config files work; it's not that "entlib is not automatically detecting" it, it's doing what the .NET framework defines the behavior of config files to be.
The answer is to leave the code in the library, but put the configuration in the web app's web.config file. Then everything will just work.
There are more advanced things you can do like manually loading the config file, but they're fairly advanced and, particularly with logging, can cause admin headaches later.

Is there any class similar to ProvidersHelper but not for web?

Is there any class similar to ProvidersHelper but not for web?
I want to instantiate a collection of providers. Actually I'm using CodeSmith & Nettiers, and the db provider is Oracle. It generated a provider section to be added at app.config, and i dont know why it uses System.Web.Configuration classes or why at this section it says SQLClient instead of OracleClient.
The error that I'm getting is:
"An unhandled exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Web.dll
Additional information: Could not load file or assembly 'LLPA.Data.OracleClient' or one of its dependencies. The system cannot find the file specified."
Any idea or solution is appreciated.
It is probably a bug if it refers to SQL Server and you are using Oracle. I'd recommend logging a bug on the .netTiers issue tracker. I'd recommend taking a look at all of the LLPA.Data.OracleClient project references are being built and ensure that they are in your bin directory of your compiled application.
Check the DLL LLPA.Data.OracleClient is in the bin folder or the GAC. If that doesn't work look into using Fuslogvw.exe.
I hadn't had added the reference of LLPA.Data.OracleClient to my application, that's why it couldn't find it.