Java - localhost root folder? - java

after lots of investigations for calling a web service from silverlight:
Calling a Java Web service from silverlight throws an exception
I found out that I should I have to create a clientaccesspolicy.xml file and put it in the root folder of the application. I copied it in the root folder of my ASPX (web page) but it didn't help. I'm guessing the root folder should be the root folder of the server for my Java service. I have apache server on my Win7 x64 system but after stopping it the Java still worked so I'm guessing that the server for Eclipse IDE is different from Apache.
So the main question here is: Where is the root folder of Java Eclipse server? Where should I put that xml file?
Thanks.

If you are using a self-hosted Java webservice with Endpoint.publish(String) then I think it is not possible to add further files for delivery, e.g. a crossdomain.xml
Instead you need to switch from a self-hosted webservice to a server-hosted webservice as described here (the tutorial is using Netbeans, but a similar approach should be possible with Eclipse, too, even if it might be slightly easier to use Netbeans for this example). As Tomcat is used as a server, it is also possible to deliver the corresponding Silverlight project files as well, in which case you do not need a crossdomain.xml

Related

Is there a way to use NetBeans's deploy on save within local LAN (JAVA Servlet)

I am working on a Java servlet project using NetBeans.
I am looking for a way to use NetBeans’s “deploy on save” on another browser of my device within LAN (locally its working fine) so that I don’t have to manually reload my browser during my development.
Recently I have decided to use proxy feature of Browsersync, but the problem of the Browsersync is, it auto reloads browser early before NetBeans completes deployment on save.
I am using GlassFish(4.1) with NetBeans.
Any help is greatly appreciated.
I had to something different in order to achieve the solution.
I am watching “glassfish/domains/domain1/config/” folder using Browsersync. Looks like after building the project, few files modified here during hot reload (so I have used watchEvents from Browsersync).
The proxy site instantly reload after NetBeans completes deployment on save.
Following is the Browsersync command.
These directory names have to be the full path with drive letter.
browser-sync start --proxy "http://localhost:8080/test" --files "src/java/com/test/, glassfish/domains/domain1/config/" --watchEvents add change " src/java/com/test/, glassfish/domains/domain1/config/" --no-notify --host 192.168.X.X --port 5000

GAE multi modules (services) and working directory

By following instruction from:
Create Google App Engine Project in Eclipse with Modules
I'm able create 1 Enterprise app and 2 associated dynamic web app (default and task). They work fine but every time running the local server (using Google plugin for Eclipse), console always display below error:
WARNING: Your working directory, (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject) is not equal to your
web application root (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject\MyProject_default.war)
...
WARNING: Your working directory, (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject) is not equal to your
web application root (D:\Workspaces\GAE\MyProject\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\MyProject\MyProject_tasks.war)
You will not be able to access files from your working directory on the production server.
Understand that it complain the working folder (which is belong to Enterprise App) is not same for both web root.
If I change the argument for working folder to root folder for default web app:
D:\Workspaces\GAE\MyProject.metadata.plugins\org.eclipse.wst.server.core\tmp1\MyProject\MyProject_default.war
First warning is no longer display but it still display second warning.
And I don't think that is right to change the working folder to default web app root folder.
In summary, because of multi modules, I have 2 root folders but only can set one working folder in argument. Is that a way to solve this problem?
Thanks
Rgds
SJ
App Engine modules have been renamed to services, in large part (I suspect) to avoid confusion with web modules. A limitation of the local development app server is that it hosts services within a single process, and a process can only have a single working directory.
This limitation only affects accessing files directly (e.g., new File("path/to/my/file")). But there are better ways to access files from within a servlet.

Loading an external class folder in eclipse - java

I am trying to use the LPsolver on a project I am working on. (it contains both jar and DLLs).
When I ran it locally it worked (System.loadLibrary("lpsolver"))
But now I am trying to upload it to an amazon server which is running tomcat.
I can't get the tomcat server to load class library correctly.
Tried to include it in all kind of different locations and loading it but non seemed to work.
Any idea how I can accomplish it ?
Thanks!
EDIT:
Tried lots of stuff I found on the web, mainly ways to include the class library I need inside the project and not a reference through the local vars.but my project does not seem to recognize it. Also wanted to upload it to my amazon web server ( to system32) but I guess because I use the free version that option is not included...

Apple Flat Package (pkg) from Java

I've been doing some research into how to make Apple flat packages from a Java webapp. There doesn't seem to be much out on the subject. I found a website that details the contents of a flat package but it seems like a bit of a project to start from scratch. Anyone have any experience building PKGs? Does anyone know of any libraries to aid in the process?
EDIT:
It seems I may not have been clear in my request. My goal is to have users go to a website that requires them to enter some information. After they've entered their information my code would create a PKG for them that contains some information about them. For example, maybe the postinsall script would run the command "say 'Hello USERNAME_THEY_ENTERED'". Silly example but it's the general idea. The user would then be able to run the PKG and the install that takes place would be customized with their information.
Why would you want a web application in a pkg file? What servlet container accepts pkg files?
Web applications are meant to be packaged as WAR or EAR files (since we are talking about Java) and to be deployed on a servlet container like tomcat, jetty, websphere, glassfish, jboss, ... running on a server. The client computer then uses a browser to access to web application on the server.
PKG files can be compared to MSI files. These are meant to facilitate the installation of software (or libraries) on a client. For that the website you linked seems to have valid information.
I am not sure why you want to do that for a webapp but we have done it for a standalone Java App (which actually was a collection of webapps including the server).
If this works for you, try to prepare your application.app folder using jarBundler. It provides an Ant task that will make things much easier.
If this does not work for you (as unfortunately was the case for us), then you have to prepare the application.app folder by hand and script adding the java resources. Start from an existing app, generated with Jar Bundler for instance, and adjust accordingly.
Then you need to install XCode and get PackageMaker. This app has a GUI but you really need to read the doc. The biggest issue we have met is that you cannot script the package build process.
I need to add that, unless you need to run some post-install scripts, building a DMG is probably much easier.

How should I setup a GWT project to be deployed in WebSphere?

I'm new to IBM Rational Application Developer. I'm running RAD 7.5.5 and want to use GWT as the front end for an application I'm writing. What I'm asking is basically if someone has had experience with this, and if so, explain in a few simple steps how it's done or maybe refer me to an example somewhere online where this is explained.
Deploying to WebSphere is no different then deploying to any other Application Server, or even a servlet container. You just need to compile your GWT app and package it in a WAR/EAR file. You deploy the application and have whatever HTML file you want the GWT app to appear in, include the nocache.js.
If you generate your app either using the command line script, through Eclipse, or with Maven, this HTML file will be generated for you. GWT is server agnostic, unless you want to use GWT-RPC, in which case you need a Java backend. You could run GWT on a plain Apache server if you wanted.

Categories

Resources