How to create ear in ATG for further usage with disposable classloader? - classloader

As it is said in ATG Platform programming guide in Appendix A p. 429 I can create ear file without including my module in ATG regular classpath (As I understood without placing my module in DYNAMO_ROOT directory), by specifying atg.nucleus.class.path in my DYNAMO_HOME/localconfig/postEnvironment.sh. After creating and deploying ear file I can modify java class and see the changes in application without rebuilding ear file and without redeploy using ATG Control Center. But in stage of assembling by runAssembler I'm getting an error:
Error: There is no installed ATG platform or application package containing an AppModule which matches myModule.
Does someone have an experience of using disposable classloader?

If you are creating ear of atg application then there are two ways:
1.)Development Mode - In development mode, the application draws its Nucleus configuration information from the Oracle ATG Web Commerce installation.
In this mod you can make configuration changes without having to rebuild the EAR file.
eq. runAssembler MyApp.ear –m MyApp DSS
2.)Standalone Mode - In standalone mode, the application stores its configuration in the EAR file itself
eq. runAssembler –standalone –server myServer MyApp.ear –m MyApp DSS

Related

Why does wso2 server.sh not pick .jars from lib folder

The wos2 server.bat sets the carbon class path to pick up jars from the lib folder however the server.sh tries to pick them up from bin.. see code below.. this causes us a big problem because in the dss documentation it says to put the database connector jars in the lib folder:
CARBON_CLASSPATH=""
if [ -e "$JAVA_HOME/lib/tools.jar" ]; then
CARBON_CLASSPATH="$JAVA_HOME/lib/tools.jar"
fi
for f in "$CARBON_HOME"/bin/*.jar
do
if [ "$f" != "$CARBON_HOME/bin/*.jar" ];then
CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
fi
done
for t in "$CARBON_HOME"/lib/commons-lang*.jar
do
CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
done
Can anyone explain this?
WSO2 Carbon is the OSGi based platform for all WSO2 java products. In Carbon, there are four different “lib” folders. If you have ever tried any of the Carbon based products, you may have thought “why are there four different libs?”. If so, this post will provide you the answer for that question.
These are the “lib” folders that you can find in Carbon.
[1] CARBON_HOME/webapps/ROOT/WEB-INF/lib
Carbon is a web app which is deployed in an embedded tomcat instance. This is the lib folder which is specific to Carbon web app just like any other web app has in WEB-INF/lib folder. Bridge servlet is the one who forwards each and every incoming request into the OSGi environment of Carbon. We have used this lib to place our Bridge Servlet. Tomcat pics it up from there and hands over the incoming requests to it.
[2] CARBON_HOME/repository/components/lib
This is the place to put your normal jars if you want them to become pure bundles in the OSGi environment. All packages in these bundles are exported into the OSGi environment. As you may know, Carbon can be extended as you wish. You can add your own bundles into it. So If you have dependent jars for those bundles, you can place those in this lib.
[3] CARBON_HOME/repository/lib
This is the place where all client libraries exist. When you run ‘ant’ from CARBON_HOME/bin, all needed jars are put into this folder. If you want to write a client (or you can generate it using the WSDL2Java tool in WSAS) and test it, the set of all jars you need in the classpath can be found in this lib. For example, WSAS samples are run by adding all these libs into client classpath.
[4] CARBON_HOME/lib
This is the place where we put all jars which are needed by tomcat to start and some others for specific reasons. This is same as the Tomcat root lib. These libraries can be seen from all webapps deployed. And also, if you place the same jar in this lib and also inside Carbon web app, it will be picked up from this root lib as Tomcat uses parent first class loading.
*** there are few libraries that are available in bin folder to get initiate the OSGi service and some special things. You can't put any jars in to the bin to reflect OSGi level or any other class loaders.
You have to put the database connector jar into DSS_HOME/repository/components/lib directory and restart the server[1]. It adds them into server class path.
[1]https://docs.wso2.com/display/DSS301/Changing+the+RDBMS

Can't load JSTL in multi module maven project with embedded jetty

I have created a test framework for testing .jsp files and .tag files using embedded jetty. I'm starting Jetty server programmatically using Java API, adding servlet holder and wrapper test JSP and initializing the server passing the project's web root.
There were some issues with Jasper discovering TLD locations during runtime when run from maven surefire plugin. I fixed it by providing
<useManifestOnlyJar>false</useManifestOnlyJar>
plugin classpath settings. Everything works good when I run tests using mvn clean install now.
Running tests from eclipse context menu has one issue. If there is any other project in workspace in the multi module maven build, TLD's in that project are not resolved. One workaround I tried was to 'close' the project in eclipse workspace and it worked out.
However I would want it to work with all the projects open in workspace and running from the eclipse JUnit context menu. The problem is in the jasper TldScanner that looks for tld files in jar and WEB-INF of current project only.
TldScanner.scanTlds()
processWebDotXml();
scanJars();
processTldsInFileSystem("/WEB-INF/");
I'm using org.glassfish.web.jsp-impl 2.2.2-b06 version with Jetty-8.1.0-RC5.
Is there a way to specify file based TLD scanning for jasper for extra classpath items?

Missing build.xml when creating project with ClickStart?

I am using Eclipse EE version and CloudBees plugin to create a ClickStart JBoss 7 project. However, I am not very familiar with the EE version of Eclipse, and used Netbeans to edit my JSP.
Then I used CloudBees SDK to run and deploy my new project but it failed (the command prompt):
D:\Personel\Java EE\HelloCloudBees>bees run
ERROR: java.io.FileNotFoundException: D:\Personel\Java
EE\HelloCloudBees\build.xml (The system cannot find the file
specified)
I found no build.xml file in my folder. How can I create it?
bees run command expect an ant-based project structure, so the build.xml. As documented
CloudBees project commands are only available for applications
generated using the Bees wizard (on the web), built using the
CloudBees SDK style.
This is more or less some legacy stuff, as is now superseded by ClickStart. Equivalent command would be bees app:run but require your app to first be packaged as a WAR and only support the default tomcat6 runtime. So for your specific use-case would be simpler to package and deploy on a local JBoss 7 server. To deploy on RUN#Cloud, use bees app:deploy or just git push and let DEV#Cloud Jenkins build and deploy for you (assuming you created app with a clickstart).
Also, there's no need to use Eclipse if you're familiar with NetBeans.
Have you tried out maven?If yes you can download it and then use mvn eclipse:eclipse and then you can import your project in your workspace using eclipse import capabilities.File -> Import -> Maven -> Existing Maven Project...you point to the file where your pom.xml file is..and is imported. Take into accoutn m2eclipse plugin in eclipse must be installed prior.
regards
\n\m

How to deploy the Web service in to tomcat 7 from out side of eclipse juno?

i am very new to web services and i have one problem please suggest me .. i.e i have a WSDL(SOAP) file and with that i created the Web Service-server and web service-Client using Top-Down approach with JAX-WS in eclipse Juno Java EE. i integrated the Tomcat 7 with that Eclipse and from eclipse its working fine.
But my problem is i need to run the Tomcat from out side of the eclipse and i need to deploy the web service in to the tomcat. i don't want to run the Tomcat using eclipse? i just need to run the client from eclipse but i dont want to run the tomcat from eclipse. Please Help me.
File -> Export -> Web -> War (configure where to create it)
Deploying a tomcat application consist of building a war file then deploying it. We call this servlet.
Building the WAR
As you already have your server code, you should now complet the WEB-INF/web.xml file. This file describe the path of your servlet(your server code), on the tomcat server. Depending of your framework you can have some configuration to add in your META-INF/context.xml file.
In an eclipse project, thoses file are generaly under a directory name 'webapp' in your project. (src/main/webapp for a maven project).
First you must use the javaee & javaweb tools of eclipse to build a war file that contains all yours libs, files, class and web.xml
Alternativly you can use a maven build process to get a war, if you use maven.
Deploying the war
After installing tomcat, the deployement is as simple as drop the .war file is deploy directory of the home-directory of tomcat. Then your application is usable on default port 8080.
If you have install also the manager webapp of tomcat, you can see all yours currently deployed application in the manager http://myurl:8080/manager/html.
When you install tomcat, let be sure that your eclipse pseudo server is shutdown, or your tomcat server will have problem to get it's port and startup.

where to place clientaccesspolicy.xml file into the apache tomcat server deployed in eclipse IDE

I have a silverlight application and i want to call a apache cxf web service written in java in my eclipse and published on apache tomcat 7.0 through eclipse.
so now when i call this web service from my silverlight application from visual studio 2010 i get follwing error:
An error occurred while trying to make a request to URI 'http://localhost:8080/complesxtypeWebService/services/CompanyServicePort'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services
when i search for this on web i found that i need to place clientaccesspolicy.xml file in the root directory of domain service.
so my problem is where to place this xml file . can it be placed somewhere in eclipse project folder or somewhere in apache tomcat folder. please let me know where to actually place this file.
my all development are done locally and everything is being tested locally.
thanks
vicky
I placed the clientaccesspolicy.xml file in C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT and it works for me.
Please note that this is Windows 7 PC and if I remove the file, I get the dreaded cross domain error.