sam wootton

Ranch Hand
+ Follow
since Apr 16, 2011
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sam wootton

Sorry that last bit should have read

In app-B i do have the context (xml bean definition for myProperties).

So:

app-A (BeanFactoryPostProcessor) with reference to myProperties bean.
app-B (the xml application conext that has myProperties). - also loads in app-A jar.

Regards, Sam
3 years ago
Thanks for your reply.

I have implemented BeanFactoryPostProcessor (i copied the code snippet above).  

I have app-a (a library) which is loaded in to app-B. In app-A I have the BeanFactoryPostProcessor, but no context. I want it to use the context defined in app-B.  In app-A i do have the context (xml bean definition for myProperties)

Im only repeating what I said above - I thought it was clear?

Regards, Sam
3 years ago
Dear JavaRanch,

Thanks all for any help.

I  think / hope this is easy to solve.  I'm not that great with Spring.  

I have a BeanFactoryPostProcessor class:



In the context xml of this application (app-A) I have no bean definition.

However in the application that uses this application (i.e. app-B, has its jar in it's /lib) directory... there is a context i.e



The problem I'm having is that when building my application (app-B) that uses app-A, I get



So I have, if you like "external" bean definition, not being picked up by the application that has the BeanFactoryPostProcessor in.

Regards, Sam
3 years ago
Apologies - I have found the issue. Another app (jar) is re-initialising log4. I added log4 debug to JAVA_OPTS catalina.sh and saw:



then later reported



Regards, Sam
3 years ago
Dear All,

Thank you for any help.

I have a log4j.properties file in the usual location:



To externally override this I added a copy (changing the log file name only) of log4j.properties in the classpath of tomcat i.e.

// catalina.properties


// copy log4j.properties


This all works fine and I can see my new "newfile.log" being written to. The problem is that after around 3-5 seconds, the OLD file starts getting written to instead (i.e. the one specified in old location):



So works fine - then switches to using the old (original) log4j.properties file under WEB-INF/classes/properties/

Any idea whats happening?

Regards, Sam




3 years ago
Is using something like this in server.xml of tomcat better?

<Context docBase="mywebapp-1.0-SNAPSHOT/someDir/js/" path="/my-js" />

The only problem is that I need more than one file referenced like this, can I have multiple <Context elements loading in different files?

Regards, Sam
3 years ago
Hello Stephan van Hulst,

Thank you for your reply.

I did try that, but Im getting 404.

My two webapps, webapp-A, and webapp-B are completely separate webapps hosted on the same tomcat. i.e. tomcat/webapps/



But trying your suggestion results in 404



From webapp-A

<script type="text/javascript" src="/mywebapp-1.0-SNAPSHOT/someDir/js/my.js"></script>

Regards, Sam


3 years ago
Dear coderanch,

I'd like to load a Javascript file from another webapp.  I have an html file in webapp-A that loads some Javascript relatively from a directory inside its own webapp i.e.



However I need to refactor this so that "my.js" now sits outside of webapp-A, and inside another webapp-B.

How can I load / reference /soource JS files from one webapp to another?

Regards, Sam
3 years ago
Thank you both for your replies. I ended up following the Maven structure for the new project.

Thanks again.

Regards, Sam

3 years ago
I guess my real decision is whether to have

project C
pom.xml
---> java module
--------> src, main test, target
---> javascript module
--------> src, main test, target

or

project C
pom.xml
---> src
--------> javascript
--------> java
---> main
---> target
3 years ago
Dear coderanch,

Thanks in advance for any help.

I have an application that has modules that handle launching of games.  This involves Javascprt, html and a few Servlets.

I've got to refactor this in to a single module.  This "launching" module will house all launching stuff (Javascript and Java web services for tomcat servlets).

The JS is compiled using Google closure, and the Servlet is javax.servlet and other core Java commons.

What should the top-level pom.xml packaging be?

Im not really sure how to structure this.  As it currently stands I have to deal with (refactor):

parent
module A
---> web services
module B
---> Javascript


But I've been asked to group this (currently split) functionality across A & B, in to a single new module (i.e a launching module).

Im stuck at the first hurdle - how should i structure my project?

Regards, Sam

3 years ago
German Gonzalez-Morris,

Thanks for your help.

The issue I have is that I rely on target/launch.html (and other files) to be present, as this is the target for replacing values in. My structure is:

src/main/webapp/my_app/launch.html

target/main/webapp/my_app/launch.html


... src has the values that need to be replaced



if i run clean, then the file(s) are not there, and the replace task fails.

nonetheless - i ran clean, and then package, the war was generated, but still launch.hhtml had the old timsetamp, and values were not replaced.

If i open up target/launch.html (outside of war, and just from the directory) the values ARE replaced... but its like maven ignores that, and then copies over the src/launch.html (with unreplaced values).

Does that make sense?

Regards, Sam
4 years ago
Dear coderanch,

Thanks in advance for any help or advice.

I'm having problems getting files updated in the war. The war itself is generated (timestamp changes), but inside the war, the dirs and files are unchanged.

I discovered this as I have a "replace" task



... the file is changed, but not included in war.

I then realised i had "bigger" problems, in that the war is generated, but seems like not everything is copied over

my pom looks like



I've tried prepare-package / install etc.

Im confused as to what phase to execute or goal to attach to, in order to get files copied i to my war and updated every time.

Big thanks for any help.

Regards, Sam
4 years ago
Just an update (conclusion hopefully).

BIG thanks for everyone's help. I was having a bit of a 'slow' day yesterday, apologies. Anyway, its all working as expected.

downloads being saved by tomcat in a (server.properties configured) location



initial servlet response (xml and POST driven) includes a unique user / download id in the headers



gwt client reads this (as part of the POST response above), makes GET request sending back id in params



servlet writes download zip as part of GET response


gwt client, upon GET response open download dialog



Marking as resolved.

Regards, Sam



4 years ago
Bear,

Great, really appreciated.

Yeap, properties file, duh, why, why didn I think of that. Sorry, bit tired today.

This is just my own / 'bedroom' app, so im not too fussed about security, but thanks for your thoughts on it.

I'll get going on implementing this, as I've asked far too many questions already.

Ill let you know how it goes.

Thanks again.

Regards, Sam
4 years ago