java Standalone Client to deploy war file to weblogic 14.1.1 - weblogic

Earlier Java Standalone client with wlfullclient.jar used to deploy the jar file to weblogic server <14x version.
But weblogic server 14.1.1 had deprecated wlfullclient.jar and wlbuilder.jar and replaced with wlthint3client.jar,
Now with wlthint3client.jar, not able to compile the below packages
import javax.enterprise.deploy.shared.ModuleType;
import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.exceptions.TargetException;
import javax.enterprise.deploy.spi.status.DeploymentStatus;
import javax.enterprise.deploy.spi.status.ProgressEvent;
import javax.enterprise.deploy.spi.status.ProgressListener;
import javax.enterprise.deploy.spi.status.ProgressObject;
import weblogic.deploy.api.spi.DeploymentOptions;
import weblogic.deploy.api.spi.WebLogicDeploymentManager;
import weblogic.deploy.api.spi.WebLogicTarget;
import weblogic.deploy.api.tools.SessionHelper;
reference link : http://middlewaremagic.com/weblogic/?p=483
After migrating weblogic to 14.1.1, added "wls-api.jar" or "com.oracle.weblogic.deployment.jar" ,"javax.javaee-api.jar" and "wlthint3client.jar" added to the class path, will all tries getting classnotfound excepitons.
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/deploy/api/internal/SPIDeployerLogger
at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.<init>(WebLogicDeploymentManagerImpl.java:108)
at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.<init>(WebLogicDeploymentManagerImpl.java:124)
at weblogic.deploy.api.spi.factories.internal.DeploymentFactoryImpl.getDeploymentManager(DeploymentFactoryImpl.java:86)
at wls.api/weblogic.deploy.api.tools.SessionHelper.getRemoteDeploymentManager(SessionHelper.java:580)
Is there any other way to implement java standalone client for deploying war to the WebLogic 14.1.1?
notices that weblogic.jar as tons of jars mapped and cannot add many jars.

Weblogic RestFull api has method to pass file so we can deploy with restFull api remotely

Related

Importing Airflow Plugin

I am currently trying to push data from Salesforce to BigQuery using Airflow. I am new to airflow and currently I'm following this link:
https://github.com/TheF1rstPancake/airflow-salesforce
When I try to import the plugin
from airflow.operators import SalesforceToFileOperator,
I get the error message stating ImportError: cannot import name 'SalesforceToFileOperator'
How do I import this plugin on Airflow?
Current Directory Structure
DAGS
salesforce_bg.py
plugins
airflow-salesforce
__init__.py
hooks
operators
What am I doing wrong?
From the official Airflow documentation: here
The python modules in the plugins folder get imported, and hooks, operators, sensors, macros, executors and web views get integrated to Airflow’s main collections and become available for use.
So, you only need to place salesforce_bg.py into the /plugins folder of your Airflow server.

Import org.apache.commons.io.FileUtils; not possible in latest apache poi.Instead import org.apache.tools.ant.util.FileUtils; is coming

In the latest Apache poi download(poi-3.15-beta2), while taking screenshot, I need to use FileUtils.copyFile. In its previous version, the imported package was import org.apache.commons.io.FileUtils;. In the latest download, this package is not coming, and it is giving error in my existing executable code. Now I tried to remove the previous import and it gave import org.apache.tools.ant.util.FileUtils;
Code:
FileUtils.copyFile(
scrFile,
new File(location+"LR_"+strDate+"_scr1.png")
);
Gives the error:
Cannot make a static reference to the non-static method
`copyFile(File, File)` from the type `FileUtils`
Apache POI never bundled or required Apache Commons IO, which contains the FileUtils class and so it seems some other project dragged in this code previously, but does not any longer. See http://poi.apache.org/overview.html#components for the list of third-party projects that Apache POI uses.
You should simply add a recent commons-io dependency to your project depending on which type of buildsystem you use, e.g. a normal dependency in Gradle/Maven or the actual jar-file if you have a buildsystem without full dependency-support.
Use the code below:
FileUtils.getFileUtils().copyFile(sourceFile, new File(directory + filename));
And import file should be:
import org.apache.tools.ant.util.FileUtils;

Embedding Glassfish v2.1.1

I have an application running on Glassfish v2.1.1 on a server and I'm looking to generate a portable (read: no-installation-required) version of it. I don't want to move to another container (Glassfish 3, Tomcat, etc.) because it will introduce new problems and bugs. I prefer to stick to the same container.
I've started taking apart the Glassfish distribution and there are some references there to paths which hint that installation is required. Has anyone been successful at generating a portable Glassfish based on v2.1.1?
Basic examples of embedding GlassFish and deploying applications to embedded GlassFish:
These examples are can be run with either of the following jars in your CLASSPATH:
Full profile uber jar : http://download.java.net/maven/glassfish/org/glassfish/extras/glassfish-embedded-all/3.1/glassfish-embedded-all-3.1.jar
Web profile uber jar: http://download.java.net/maven/glassfish/org/glassfish/extras/glassfish-embedded-web/3.1/glassfish-embedded-web-3.1.jar
Installed GlassFish's shell jar : $GF_INSTALLATION/lib/embedded/glassfish-embedded-static-shell.jar
Once you have ANY ONE of the above jar file with you, GlassFish can be embedded in your application by simply doing:
import org.glassfish.embeddable.*;
/** Create and start GlassFish */
GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish();
glassfish.start();
Let us say that you would like 8080 web container port to be started while embedding GlassFish, then you have to do this:
import org.glassfish.embeddable.*;
/** Create and start GlassFish which listens at 8080 http port */
GlassFishProperties gfProps = new GlassFishProperties();
gfProps.setPort("http-listener", 8080); // refer JavaDocs for the details of this API.
GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish(gfProps);
glassfish.start();
Once you have the GlassFish embedded and is running, you may like to deploy a pre-built Java EE archive using the code below:
import org.glassfish.embeddable.*;
// Obtain the deployer from the glassfish which is embedded via the piece of code above.
Deployer deployer = glassfish.getDeployer();
// syntax of deployment params are same as how they are passed to 'asadmin deploy' command.
deployer.deploy(new File("simple.war"), "--contextroot=test", "--name=test", "--force=true");
// if you have no deployment params to pass, then simply do this:
deployer.deploy(new File("simple.war"));
If your archive is not pre-built, instead it's components are scattered in multiple directories, then you may be interested in using the scattered archive APIs:
import org.glassfish.embeddable.*;
import org.glassfish.embeddable.archive.*;
Deployer deployer = glassfish.getDeployer();
// Create a scattered web application.
ScatteredArchive archive = new ScatteredArchive("testapp", ScatteredArchive.Type.WAR);
// target/classes directory contains my complied servlets
archive.addClassPath(new File("target", "classes"));
// resources/sun-web.xml is my WEB-INF/sun-web.xml
archive.addMetadata(new File("resources", "sun-web.xml"));
// resources/MyLogFactory is my META-INF/services/org.apache.commons.logging.LogFactory
archive.addMetadata(new File("resources", "MyLogFactory"), "META- INF/services/org.apache.commons.logging.LogFactory");
deployer.deploy(archive.toURI())
Similarly, the scattered enterprise application (EAR type) can be deployed like this:
import org.glassfish.embeddable.*;
import org.glassfish.embeddable.archive.*;
Deployer deployer = glassfish.getDeployer();
// Create a scattered web application.
ScatteredArchive webmodule = new ScatteredArchive("testweb", ScatteredArchive.Type.WAR);
// target/classes directory contains my complied servlets
webmodule.addClassPath(new File("target", "classes"));
// resources/sun-web.xml is my WEB-INF/sun-web.xml
webmodule.addMetadata(new File("resources", "sun-web.xml"));
// Create a scattered enterprise archive.
ScatteredEnterpriseArchive archive = new ScatteredEnterpriseArchive("testapp");
// src/application.xml is my META-INF/application.xml
archive.addMetadata(new File("src", "application.xml"));
// Add scattered web module to the scattered enterprise archive.
// src/application.xml references Web module as "scattered.war". Hence specify the name while adding the archive.
archive.addArchive(webmodule.toURI(), "scattered.war");
// lib/mylibrary.jar is a library JAR file.
archive.addArchive(new File("lib", "mylibrary.jar"));
// target/ejbclasses contain my compiled EJB module.
// src/application.xml references EJB module as "ejb.jar". Hence specify the name while adding the archive.
archive.addArchive(new File("target", "ejbclasses"), "ejb.jar");
deployer.deploy(archive.toURI())
Finally, towards the end of your application, you would like to stop/dispose your embedded GlassFish:
import org.glassfish.embeddable.*;
/** Stop GlassFish */
glassfish.stop(); // you can start it again.
/** Dispose GlassFish */
glassfish.dispose(); // you can not start it again. But you can embed a fresh glassfish with GlassFishRuntime.bootstrap().newGlassFish()

Error Deploying portlets

I am trying to setup some boiler plate code in my local workspace which uses weblogic10.3. I have a documentation that asks me to import Content.jar from /wlportal_10.3/content-mgmt/lib into window->preferences-->Weblogic-->Shared Library which I did. However when I try to deploy portlet this is the error am getting
Error Deployer BEA-149107 An attempt was made to deploy library 'content' with specified specification version '10.3.2' and implementation version '10.3.2 '. However, the library manifest has specification version '10.3.2' and implementation version '10.3.2'

weblogic tapestry issues

My application using tapestry 4.1.6 jar files deploys correctly in weblogic 10.3.3.0. But at runtime, I am getting NoSuchMethodException from tapestry files.Same application works fine in weblogic 9. Any ideas?
Error Log
java.lang.NoSuchMethodError: org.apache.commons.pool.impl.TapestryKeyedObjectPool.assertOpen()V
at org.apache.commons.pool.impl.TapestryKeyedObjectPool.borrowObject(TapestryKeyedObjectPool.java:941)
at org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:176)
at $IPageSource_12bf9e5c33a.getPage($IPageSource_12bf9e5c33a.java)
at org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:241)
at org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:228)
at org.apache.tapestry.engine.DirectService.service(DirectService.java:107)
at $IEngineService_12bf9e5c3ad.service($IEngineService_12bf9e5c3ad.java)
at org.apache.tapestry.services.impl.EngineServiceInnerProxy.service(EngineServiceInnerProxy.java:77)
at org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:72)
at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:241)
at org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:54)
at $WebRequestServicer_12bf9e5c384.service($WebRequestServicer_12bf9e5c384.java)
at $WebRequestServicer_12bf9e5c380.service($WebRequestServicer_12bf9e5c380.java)
at org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:61)
at $ServletRequestServicer_12bf9e5c366.service($ServletRequestServicer_12bf9e5c366.java)
at org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
at $ServletRequestServicerFilter_12bf9e5c362.service($ServletRequestServicerFilter_12bf9e5c362.java)
at $ServletRequestServicer_12bf9e5c368.service($ServletRequestServicer_12bf9e5c368.java)
at org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
at $ServletRequestServicerFilter_12bf9e5c360.service($ServletRequestServicerFilter_12bf9e5c360.java)
at $ServletRequestServicer_12bf9e5c368.service($ServletRequestServicer_12bf9e5c368.java)
at org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
I'd check to see if WebLogic 10.3 has a conflicting Tapestry JAR at the server class loader level. If yes, you'll want to tell WebLogic to prefer the version of Tapestry that it finds using your application class loader.
See <prefer-web-inf-classes> in weblogic.xml:
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/programming/classloading.html
Note: Weblogic is often configured by default, it filters javax.* package. (X Add J2EE libraries to buildpath)