I have a web application which is installed on Websphere with WAR file. I am trying to automatically deploy the webapplication on websphere through a python script. The script is as follows:
###cat deplApps.py
import time
#the 3 arguments are jvm name, ent app name, and path to war file
print "Args are:" , sys.argv
SERVERMBEAN = AdminServerManagement.queryMBeans("AppSrvNode01", sys.argv[0] , "Server")
if SERVERMBEAN == [] :
print "Server is in stopped state"
else :
AdminServerManagement.stopSingleServer("AppSrvNode01", sys.argv[0] )
print "sleeping for 10 seconds"
time.sleep(10)
AdminApplication.updateApplicationUsingDefaultMerge( sys.argv[1], sys.argv[2] )
AdminConfig.save()
time.sleep(10)
Sync1 = AdminControl.completeObjectName('type=NodeSync,process=nodeagent,node=AppSrvNode01,*')
AdminControl.invoke(Sync1, 'sync')
print "sleeping for 120 seconds before starting the server"
time.sleep(120)
AdminServerManagement.startSingleServer("AppSrvNode01", sys.argv[0] )
When I run the script to deploy the war file on Websphere I get the following error:
Exception: <type 'com.ibm.ws.scripting.ScriptingException'> com.ibm.ws.scripting.ScriptingException: WASX7109E: Insufficient data for install task "MapWebModToVH
ADMA0010E: Validation error in task Selecting virtual hosts for Web modules. A virtual host is not specified for web module Work Queues with URI agriworxAPP.war,WEB-INF/web.xml."
WASX7017E: Exception received while running file "/apps/deploy/deplApps.py"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7109E: Insufficient data for install task "MapWebModToVH
When I searched for the error it said I have to provide the ibm-web-bnd.xml ibm-web-ext.xml in the WAR file, So I provided the fillowing ibm-web-bnd.xml and ibm-web-ext.xml files inthe WAR file;
ibm-web-bnd.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-bnd
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd"
version="1.0">
<virtual-host name="default_host"
<resource-ref>
<description>Work Queues</description>
<res-ref-name>jdbc/WorkQueuestDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>/>
</web-bnd>
ibm-web-ext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-ext
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
version="1.0">
<default-error-page uri="error.jsp"/>
<jsp-attribute name="useThreadTagPool" value="true" />
<jsp-attribute name="verbose" value="false" />
<jsp-attribute name="deprecation" value="false" />
<jsp-attribute name="reloadEnabled" value="true" />
<jsp-attribute name="reloadInterval" value="5" />
<jsp-attribute name="keepgenerated" value="true" />
<jsp-attribute name="trackDependencies" value="true" />
<reload-interval value="9"/>
<auto-encode-requests value="true"/>
<auto-encode-responses value="false"/>
<enable-directory-browsing value="false"/>
<enable-file-serving value="false"/>
<pre-compile-jsps value="false"/>
<enable-reloading value="true"/>
<enable-serving-servlets-by-class-name value="true"/>
</web-ext>
Now I am getting the following errorL
Exception: <type 'com.ibm.ws.scripting.ScriptingException'> com.ibm.ws.scripting.ScriptingException: WASX7109E: Insufficient data for install task "MapWebModToVH
ADMA0010E: Validation error in task Selecting virtual hosts for Web modules. A virtual host is not specified for web module Work Queues with URI agriworxAPP.war,WEB-INF/web.xml."
In my case, I was having this error because my app required some bindings to be made. As I wanted to install the app with all the default configurations I just needed to add the parameter -usedefaultbindings.
AdminApp.install("/work/shared/myApp.ear", "-appname myApp -node DefaultNode01 -server server1 -nouseMetaDataFromBinary -usedefaultbindings")
This error has nothing to do with .bnd or .ext files. The command AdminApplication.updateApplicationUsingDefaultMerge as it name stats is used to update existing app, not to install new one. If you want to install you need to use AdminApplication.installXXX commands. Check https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.base.doc/ae/rxml_7libapp.html So you need to utilize AdminApplication.checkIfAppExists command and based on that either install or update app.
VH is virtual host on your WAS, typically default_host. Sometimes it is used to customize installation see this https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.base.doc/ae/rxml_taskoptions.html#rxml_taskoptions__cmd61 but I dont know how the AdminApplication is actually utilizing it.
Related
I have several .launch files for Eclipse (I'm using Eclipse Oxygen), here is an example
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false" />
<stringAttribute key="M2_GOALS" value="clean com.google.cloud.tools:appengine-maven-plugin:deploy" />
<booleanAttribute key="M2_NON_RECURSIVE" value="false" />
<booleanAttribute key="M2_OFFLINE" value="false" />
<stringAttribute key="M2_PROFILES" value="" />
<listAttribute key="M2_PROPERTIES" />
<stringAttribute key="M2_RUNTIME" value="EMBEDDED" />
<booleanAttribute key="M2_SKIP_TESTS" value="true" />
<intAttribute key="M2_THREADS" value="1" />
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false" />
<stringAttribute key="M2_USER_SETTINGS" value="" />
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false" />
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}" />
</launchConfiguration>
Note that I'm using ${project_loc} variable in order to make it usable for any project.
I'm using this kind of files because I can share those with my team. Also the most used Maven Build configurations are ready to go w/o configuring every time a new launch profile.
The problem I'm facing is related to the profile value
<stringAttribute key="M2_PROFILES" value="" />
With the CTRL+ALT+P shortcut on a project, I can select the proper profile to load (Select Maven Profiles... function). I'm using different profile to discern the environment for the deploy (development, stage o production).
I'm trying to "inject" the profile I enabled for the project into the generic launch profile configuration, something like the ${project_loc} variable but related to the current Maven profile.
If this cannot be made I need to create a launch profile for each environment, which means 3 files per every goal to launch.
Is there a way to use/create an Eclipse variable that can be resolved with the Maven profile I activated on the project?
Something like
<stringAttribute key="M2_PROFILES" value="${maven.profile.id}" />
You'll need to create an Eclipse plugin (or contribute to Eclipse m2e project) in order to define a variable using the dedicated extension-point.
I have an app service, hosted on Azure.
The code for our service is on bitbucket and it is a maven based Java project. The process adopted by developers to deploy WAR files is to build them on local and FTP it to Azure which obviously isn't recommended.
Let's say I don't have the liberty and resource for hosting a CI tool like Jenkins, I am trying to do the following:
Sync the code from bitbucket.org to Azure by using 'Deployment Options' in Azure. Every time I do a git push, Azure automatically picks up the code from the specified branch and copies/updates/deletes the files modified (and places them under wwwroot by default)
I want to modify the deployment.cmd file in Azure so that I can add my custom steps post #1.
Where am I stuck?
I have FTPed maven and unpacked maven under D:\home\maven folder. I have set the correct environment variables by using a XDT file (attached). Yet, when I do mvn -version, I get the following error:
java.lang.NoClassDefFoundError:
org/apache/maven/exception/ExceptionHandler
..
..
caused by ClassNotFound ..
I don't have the complete trace handy. This class is there in maven-core which is there under the lib folder (I verified).
Could it be because of permissions? Cloud is cloudy to me o_O
After I get this to work, I need to add custom steps to deployment.cmd. Is there any specific language which I need to use or windows commands?
XDT file content for env variables (JAVA_HOME is already set)
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document- Transform">
<system.webServer>
<runtime xdt:Transform="InsertIfMissing">
<environmentVariables xdt:Transform="InsertIfMissing">
<add name="M2_HOME" value="D:\home\maven\apache-maven-3.3.9" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
<add name="MAVEN_HOME" value="D:\home\maven\apache-maven-3.3.9" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
<add name="Path" value="%Path%%JAVA_HOME%\bin;%M2_HOME%\bin;" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
</environmentVariables>
</runtime>
</system.webServer>
I tried to reproduce the issue, but failed. According to the kudu wiki page for Xdt transform samples, the environment variables seems not support reference each other which had been defined above the current environment varable.
So please change the XDT file content like below that works fine after I test on an Azure Web App instance for Java.
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<runtime xdt:Transform="InsertIfMissing">
<environmentVariables xdt:Transform="InsertIfMissing">
<add name="M2_HOME" value="D:\home\maven\apache-maven-3.3.9" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
<add name="MAVEN_HOME" value="D:\home\maven\apache-maven-3.3.9" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
<add name="PATH" value="%PATH%;D:\home\maven\apache-maven-3.3.9\bin" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
</environmentVariables>
</runtime>
</system.webServer>
</configuration>
Then I ran the command mvn -version on Kudu CMD tool, it works fine.
I got an exception at System.setProperty in Java when I've tried to deploy the application in GAE. Any ideas what can be wrong?
You can set Java system properties or environment variables for App Engine applications in the respective appengine-web.xml configuration file.
<system-properties>
<property name="property1" value="value1" />
<property name="property2" value="value2" />
</system-properties>
You can find more details in App Engine documentation.
After stumbling my way through setting up a BlazeDS service, I was finally able to get the list of services through the Flex Builder Data/Services Wizzard. However when testing any of the services, I get the Error popup of
> "InvocationTargetException:There was an error while invoking the
> operation. Check your operation inputs or server code and try invoking
> the operation again.
>
> Reason: java.io.FileNotFoundException:
> http://127.0.0.1:8080/portlets-0.0.1-SNAPSHOT/messagebroker/amf/
I could not find anyone else with a similar issue, and am unfamiliar with services setup. Below are my configurations. Any help would be greatly appreciated.
I can post config files if it will help, i was getting improper code format errors trying to insert them in this single post.
This service I am testing does not reach the function in the server, it is throwing this error before getting that far...
I have also noticed that I cannot run the flex application through a web browser using the standard run configuration in eclipse as it tries to target:
[http://127.0.0.1:8080/portlets-0.0.1-SNAPSHOT/messagebroker/amf/FlexMissionsOverview/MissionsPortlet.html][1]
Which throws a 404 error on tomcat since the file does not exist there. Are these possibly connected?
Any help would be greatly appreciated.
Added Details based on feedback:
Yes, the project name is "FlexMissionsOverview" with a Base Flex Application Called "MissionsPortlet"(.mxml).
The webapp is deployed to "webapps/portlets-0.0.1-SNAPSHOT/"
Compiler settings below:
-services "C:\liferay\liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\portlets-0.0.1-SNAPSHOT\WEB-INF\flex\services-config.xml" -locale en_US
-show-deprecation-warnings=false
-show-binding-warnings=false
Note: I am setting my project back up to where I had gotten to by the time of this post, if anything changes I will make another edit.
services-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service-include file-path="remoting-config.xml" />
<service-include file-path="proxy-config.xml" />
<service-include file-path="messaging-config.xml" />
</services>
<factories>
<factory id="spring" class="flex.samples.factories.SpringFactory"/>
</factories>
<services>
<service id="remoting-service" class="flex.messaging.services.RemotingService">
<adapters>
<adapter-definition id="java-object"
class="flex.messaging.services.remoting.adapters.JavaAdapter"
default="true" />
</adapters>
<default-channels>
<channel ref="my-amf" />
</default-channels>
</service>
</services>
<channels>
<channel-definition id="my-amf"
class="mx.messaging.channels.AMFChannel">
<endpoint
url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint" />
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
</channels>
<logging>
<!-- You may also use flex.messaging.log.ServletLogTarget -->
<target class="flex.messaging.log.ConsoleTarget" level="Error">
<properties>
<prefix>[BlazeDS] </prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>true</includeLevel>
<includeCategory>false</includeCategory>
</properties>
<filters>
<pattern>Endpoint.</pattern>
<pattern>Service.</pattern>
<pattern>Configuration</pattern>
</filters>
</target>
</logging>
</services-config>
Pointing to the file directly on the tomcat server seems to work fine for testing the Flex Application via Eclipse, but I am still getting the same "FileNotFoundException" When trying to test the BlazeDS Services in the Data/Services Wizard in FlashBuilder.
Is there any indication of what the FileNotFoundException is coming from when trying to test the services? It may be some of the config information, but I am not positive, since I am used to these Exceptions saying what file it could not find.
The only class that I have in my project that is referenced above is the two listener classes, the other classes I believe come from my maven dependencies.
Context
I have a JBoss where I have sucessfully deployed a datasource mydatasource-ds.xml.
It's JNDI name is java:mydatasourceDS. JBoss claims that the datasource is succesfully deployed. The JMX console agress too.
Problem
I want to use this datasource from a client java app launched on a separate JVM.
But I get an exception saying the java:mydatasourceDS cannot be found.
java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.sql.DataSource
Details
Here is the persistence.xml file :
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="mydatasource-db" transaction-type="JTA">
<jta-data-source>java:mydatasourceDS</jta-data-source>
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.default_schema" value="rec" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
</properties>
</persistence-unit>
Here is the jndi.properties file :
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Here is the application classpath :
jndi.properties
log4j.properties
META-INF\persistence.xml
hibernate-jpa-2.0-api-1.0.0.Final.jar
jnp-client-5.0.3.GA.jar
jboss-common-core-2.2.14.GA.jar
jboss-logging-spi-2.1.0.GA.jar
hibernate-entitymanager-3.6.4.Final.jar
hibernate-core-3.6.4.Final.jar
antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
hibernate-commons-annotations-3.2.0.Final.jar
jta-1.1.jar
javassist-3.12.0.GA.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
log4j-1.2.16.jar
xstream-1.4.1.jar
xmlpull-1.1.3.1.jar
xpp3_min-1.1.4c.jar
EDIT
I have found the source of the problem. The javax.sql.DataSource that was available to my client application was NOT the one received from JNDI. The one I receive from JNDI is the JBoss javax.sql.DataSource. Same name BUT slightly different classes hence the ClassCastException...
As of this writing, the JBoss javax.sql.DataSource can be found in this package : jboss-j2ee-4.2.3.GA.jar
If you get a
javax.naming.Reference
that means you are missing runtime dependencies that are required for it to resolve. You can inspect the classFactory member of the Reference object via
getFactoryClassName()
to figure out the first dependency you are missing.
In my case using JBoss6.1 it was:
org.jboss.resource.adapter.jdbc.remote.DataSourceFactory
Putting the jar this class is in on the classpath (common/lib/jbosscx-client.jar) got me past the first step and then it was a matter of tracking down all the ClassNotFoundException errors.
The full list for JBoss6.1 turned out to be:
- client/jnp-client.jar
- client/jboss-logging.jar
- common/lib/jbosscx-client.jar
- client/concurrent.jar
- client/jboss-client.jar
- client/jboss-common-core.jar
- client/jboss-integration.jar
- client/jboss-remoting.jar
- client/jboss-security-spi.jar
- client/jboss-serialization.jar
- client/jboss-transaction-api_1.1_spec.jar
This guide says that you have to set
<use-java-context>false</use-java-context>
in mydatasource-ds.xml. Not sure if you did.