Could not start GlassFish SERVERE: CORE10012 Application previously deployed is not at its original location any more - glassfish-3

When i deleted the projects that i deployed once in the past,
i could not start the server because of this error:
Launching GlassFish on Felix platform
INFO: Running GlassFish Version: GlassFish Server Open Source Edition
3.1.2.2 (build 5)
INFO: Registered
org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for
persistence-type = replicated in BackingStoreFactoryRegistry
INFO: Grizzly Framework 1.9.50 started in: 125ms - bound to
[0.0.0.0:8181]
INFO: Grizzly Framework 1.9.50 started in: 109ms - bound to
[0.0.0.0:4848]
INFO: Grizzly Framework 1.9.50 started in: 31ms - bound to
[0.0.0.0:7676]
INFO: Grizzly Framework 1.9.50 started in: 125ms - bound to
[0.0.0.0:3700]
INFO: The Admin Console is already installed, but not yet loaded.
SEVERE: CORE10012: Application previously deployed is not at its
original location any more:
file:/C:/Documents%20and%20Settings/2796/My%20Documents/NetBeansProjects/mavenprojectJSF/target/mavenprojectJSF-1.0-SNAPSHOT/
SEVERE: CORE10012: Application previously deployed is not at its
original location any more:
file:/C:/Documents%20and%20Settings/2796/My%20Documents/NetBeansProjects/jsf1/build/web/
SEVERE: CORE10012: Application previously deployed is not at its
original location any more:
file:/C:/Documents%20and%20Settings/2796/My%20Documents/NetBeansProjects/struts/build/web/
SEVERE: CORE10012: Application previously deployed is not at its
original location any more:
file:/D:/self%20learning%202014/struts2/Struts2-ExecAndWait-Interceptor-Example/Struts2Example/target/Struts2Example/
INFO: GlassFish Server Open Source Edition 3.1.2.2 (5) startup time :
Felix (2,078ms), startup services(1,422ms), total(3,500ms)
SEVERE: Shutting down v3 due to startup exception : No free port
within range:
8080=com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectorHandler#14fccd
INFO: Server shutdown initiated
INFO: Already stopped, so just returning

I modified the file
domain.xml
In
C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1
And removed the application tags of xml and application-ref tags too for those projects mentioned above.
And i deleted the projects folder when i searched inside the glassfish folder
in
--> domains folder --> applications folder
To make it as i never deployed any personal project with it.
This way you are undeploying the applications on server without starting it that what was causing the error

I have encountered the same problem under Glassfish 4.1 after having migrated from Netbeans 8.2 to IntelliJ Idea.
To solve this problem I have only deleted application tags in domain.xml file.
I have deleted lines commented in following code
<applications>
<!-- TO-DELETE
<application context-root="/tlga" object-type="user" name="web" directory-deployed="true" location="file:/C:/GIT_SOURCES/TLGA-Web/web/target/tlga-1.18-SNAPSHOT/">
<property name="archiveType" value="war"></property>
<property name="appLocation" value="file:/C:/GIT_SOURCES/TLGA-Web/web/target/tlga-1.18-SNAPSHOT/"></property>
<property name="org.glassfish.ejb.container.application_unique_id" value="100406159636627456"></property>
<property name="org.glassfish.persistence.app_name_property" value="web"></property>
<property name="defaultAppName" value="tlga-1.18-SNAPSHOT"></property>
<module name="web">
<engine sniffer="ejb"></engine>
<engine sniffer="security"></engine>
<engine sniffer="webservices"></engine>
<engine sniffer="weld"></engine>
<engine sniffer="jpa"></engine>
<engine sniffer="web"></engine>
</module>
</application>
<application context-root="/tlga" object-type="user" directory-deployed="true" name="tlga-1.17.3" location="file:/C:/GIT_SOURCES/TLGA-WEB/web/target/tlga-1.17.3/">
<property name="archiveType" value="war"></property>
<property name="appLocation" value="file:/C:/GIT_SOURCES/TLGA-WEB/web/target/tlga-1.17.3/"></property>
<property name="org.glassfish.ejb.container.application_unique_id" value="100519021875888128"></property>
<property name="org.glassfish.persistence.app_name_property" value="tlga-1.17.3"></property>
<property name="defaultAppName" value="tlga-1.17.3"></property>
<module name="tlga-1.17.3">
<engine sniffer="ejb"></engine>
<engine sniffer="security"></engine>
<engine sniffer="webservices"></engine>
<engine sniffer="weld"></engine>
<engine sniffer="jpa"></engine>
<engine sniffer="web"></engine>
</module>
</application>
-->
</applications>
For me, DOMAIN.XML file is located in another location. To find it, I have searched to DOMAIN.XML files in c:\Glassfish.4.1\glassfish\domains folder.
I have deleted the 2 existing "/tlga" domains. Removing only one doesn't resolve my issue.
Explanation of how this error occurs:
These 2 <application> tags has been automatically generated by IntelliJ IDEA ULTIMATE 2018.2 !!! The first time I have deployed tlga-1.17.3, I don't have encountered any problem.
But this version was PRODUCTION version!
I have then switched GIT environment from PRODUCTION to DEVELOPMENT. I have build new release and started application again.
I suppose that IntelliJ has added a second <application> tag in domain.xml file and started again Glassfish that has refused to start !

Related

Tomcat 7: BeanInitializazionException with Spring MVC and external property file

I have a web application bulit in Spring MVC that has an external property file.
The external file is defined in application-config.xml as follows:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<!-- file di properties -->
<value>file:/myfolder/myfilename.properties</value>
<value>classpath:environment.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>
The file is in /myfolder and is under my C:\ folder, but I need to deploy it (in production environment) on a Linux machine in which the property file path is /myfolder.
This web application runs well in Netbeans IDE (8.2) with local Tomcat 7 instance.
I am trying to run it in Eclipse with same local Tomcat 7 instance but I obtain the following exception:
ERROR ContextLoader:319 - Context initialization failed
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: \myfolder\myfilename.properties (Impossible to find the path specified)
I've tried to change the server configuration in Eclipse, but nothing happens. How can I solve this issue?

GAE Java 8 Runtime: java.nio.file.InvalidPathException: Illegal char <:> at index 68 in request URL

I use Spring MVC (not Spring Boot) for my Google App Engine REST based web-app. Today I upgraded GAE Java runtime to 1.8 (Java 8) and servlet-api 3.1. AppEngine SDK version 1.9.56.
All the spring beans load perfectly without any error. I get this exception while its serving a request:
GET http://localhost:9080/api/systems/urn:bnb:system:0ee64dc1-5dcd-46a5-aeaa-3d15858cb79e/details
2017-10-09 17:26:47.760:WARN:oejs.ServletHandler:qtp823914581-19: /api/systems/urn:bnb:system:0ee64dc1-5dcd-46a5-aeaa-3d15858cb79e/details
java.nio.file.InvalidPathException: Illegal char <:> at index 68: C:\Amit\APP\app\apisvc\build\exploded-app\/api/systems/urn:bnb:system:0ee64dc1-5dcd-46a5-aeaa-3d15858cb79e/details/index.html
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at org.eclipse.jetty.util.resource.PathResource.<init>(PathResource.java:213)
at org.eclipse.jetty.util.resource.PathResource.addPath(PathResource.java:304)
at com.google.appengine.tools.development.jetty9.StaticFileFilter.getResource(StaticFileFilter.java:133)
at com.google.appengine.tools.development.jetty9.StaticFileFilter.maybeServeWelcomeFile(StaticFileFilter.java:172)
at com.google.appengine.tools.development.jetty9.StaticFileFilter.doFilter(StaticFileFilter.java:96)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
at com.google.appengine.tools.development.jetty9.DevAppEngineWebAppContext.doScope(DevAppEngineWebAppContext.java:94)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at com.google.appengine.tools.development.jetty9.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:597)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:534)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.execute(ExecuteProduceConsume.java:100)
at org.eclipse.jetty.io.ManagedSelector.run(ManagedSelector.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
at java.lang.Thread.run(Thread.java:745)
And here is my appengine-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<!-- Test GAE instance -->
<application>webapp-1013</application>
<version>1-2</version>
<threadsafe>false</threadsafe>
<runtime>java8</runtime>
<system-properties>
<property name="DEFAULT_ENCODING" value="UTF-8" />
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<sessions-enabled>true</sessions-enabled>
<inbound-services>
<service>warmup</service>
</inbound-services>
</appengine-web-app>
I didn't face this problem when I was using Java 7 runtime with GAE. Please help.
It looks like you are hitting a bug that affects the development app server on Windows (it does not affect apps deployed to production App Engine). The bug is being tracked here: https://issuetracker.google.com/issues/63595917
A fix for this is included in the upcoming SDK release, 1.9.58.

Session replication not working in glassfish on multi node cluster

Session replication not working in glassfish on multi node cluster
1) application contains distributable tag in web.xml
2) application when deployed in cluster c1, which contains 2 instances present on same node, session replication works.
3) Same application when deployed in cluster c2, which contains 2 instances present on two CentOS machines, session replication does not works.
Following are content of glassfish-web.xml (if required for reference) :
<glassfish-web-app error-url="">
<session-config>
<session-manager persistence-type="replicated">
<manager-properties>
<property name="persistenceFrequency" value="web-method" />
<property name="relaxCacheVersionSemantics" value="true"/>
</manager-properties>
<store-properties>
<property name="persistenceScope" value="session" />
</store-properties>
</session-manager>
<!--<cookie-properties>
<property name="cookieDomain" value="node2"/>
<property name="cookieDomain" value="node4"/>
</cookie-properties> -->
<cache max-entries="4096" timeout-in-seconds="30" enabled="false">
<default-helper/>
</cache>
</session-config>
<context-root>/contextNaam</context-root>
<class-loader delegate="true"/>
<resource-ref>
<res-ref-name>jdbc/safe</res-ref-name>
<jndi-name>jdbc/safe</jndi-name>
</resource-ref>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
Edit : 1) Does not seems to be a UDP communication issue between 2 centos machines.
2) Tried to create tcp-cluster as mentioned in HA-administration-guide also, but still same effect, session not replicated on tcpcluster.
There was a bug in Shoal and incompatibility with Grizzly. I have fixed it in Payara and the fix is now in Glassfish too.
Current state is that it seems it works (Payara 4.1.1.154).
Under CentOS, you might run into trouble with SELinux and firewall rules. I suggest you disable them and try again.
I had a similar issue, though using JBoss, not Glassfish.
E.

Invalid Oracle URL specified: OracleDataSource.makeURL in Arquillian ITest

I persist with every error I get thrown and mostly always work out the solution. I find a good walk helps. But this one has me stumped, I've been staring at this same error all day. Like Ticcie in Invalid Oracle URL specified: OracleDataSource.makeURL suggests, the error message does nothing to help understand what is wrong.
SEVERE: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Invalid Oracle URL specified: OracleDataSource.makeURL
Error Code: 0
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:762)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
I am doing Arquillian Integration Testing for a Java EE 7 EAR application. Its been going well using JPA and the DerbyDb but I now need to test Native Oracle DB (11g) SQL. So I've setup a new testing project to connect to an OracleDB using EclipseLink.
I CAN connect to the database through the Eclipse IDE DataSource explorer and ping it no problems.
I DO connect to a sister Oracle database in Glassfish standalone and ping it no problems.
But the Arquillian Test cannot connect to it with the above ambiguous error. It would be nice if the error said what exactly is the problem.
I use exactly the same URL as I have with the Eclipse IDE DataSource explorer:
jdbc:oracle:thin:#marina.work.com:1521:orcl
The Arquillian setup is the same as I did for DerbyDb (pretty-much same as http://arquillian.org/guides/testing_java_persistence/) with these variations for OracleDB:
src/main/resources-glassfish-embedded/sun-resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-resource pool-name="ArquillianOraclePool" jndi-name="jdbc/arquillian" />
<jdbc-connection-pool name="ArquillianOraclePool" res-type="javax.sql.DataSource" datasource-classname="oracle.jdbc.pool.OracleDataSource"
is-isolation-level-guaranteed="false" >
</jdbc-connection-pool>
</resources>
src/main/resources-glassfish-embedded/test-persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">
<persistence-unit name="esaarch01-pu" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/arquillian</jta-data-source>
<jar-file>test.jar</jar-file>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.Url" value="jdbc:oracle:thin:#marina.work.com:1521:orcl" />
<property name="javax.persistence.jdbc.Password" value="demo" />
<property name="javax.persistence.jdbc.User" value="test" />
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver" /> <!-- driver. -->
<property name="javax.persistence.jdbc.platform" value="org.eclipse.persistence.platform.database.oracle.OraclePlatform" />
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.logging.level" value="FINE" />
<property name="eclipselink.logging.level.sql" value="FINE" />
</properties>
</persistence-unit>
</persistence>
I've introduced XML well-formedness errors such as text in the properties element and receive the following error. This shows that this file is being picked up for the correct purposes:
java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 21; columnNumber: 16; Deployment descriptor file META-INF/persistence.xml in archive [test.jar]. cvc-complex-type.2.3: Element 'properties' cannot have character [children], because the ...
I've tried different property names but none change the error message. Which makes me think that the URL property isn't being picked up at all.
I've tried different variations of the URL (with matching mods for name and password):
javax.persistence.jdbc.url URL Url (three variations)
eclipselink.jdbc.url URL Url (three variations)
No variation works. Same error.
It would be really nice if the exception can be more specific about what it can and cannot find.
My question is, can anyone tell me the solution or suggest what's wrong or something I can try and work out what is going wrong?
UPDATE
I've posted this question on the Oracle forums and included the entire stack trace and the sample minimal code plus some instructions. If anyone is keen to look at it I'd be grateful.
https://forums.oracle.com/message/11152777#11152777
driver type is not provided, for my case, I used "thin" xaProperties.driverType="thin", please find similar config for your case.

External properties loader with Tomcat server

I am trying to deploy a spring mvc webapp into a tomcat server. I have been testing locally using the maven-jetty-plugin. In my spring configuration I am using a properties placeholder, and pulling my properties from an external file:
<context:property-placeholder ignore-resource-not-found="true" ignore-unresolvable="true"/>
<bean id="modelPropertyPlaceholder" class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
<property name="searchContextAttributes" value="true"/>
<property name="contextOverride" value="true"/>
<property name="ignoreResourceNotFound" value="true"/>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<property name="locations">
<list>
<value>classpath:default.model.properties</value>
<value>file:/etc/app/app.properties</value>
<value>${config}</value>
</list>
</property>
</bean>
This worked with my jetty plugin...however when I deploy the WAR file to the tomcat server I receive the following error:
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
In my external properties file I have the driver class and connect url defined. as so:
jndi.jpa.rms.datasource=jdbc/testDS
rms.db.driver=com.mysql.jdbc.Driver
rms.db.url=jdbc:mysql://testdatabaseurl:3306/test
rms.db.user=sa
rms.db.password=asfdas
rms.db.checkconnsql=select 1
rms.hibernate.generateddl=false
rms.hibernate.showsql=true
rms.hibernate.dbdialect=org.hibernate.dialect.MySQLDialect
Update:
It seems that tomcat does pickup the external properties file:
14:23:09.803 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'modelPropertyPlaceholder'
14:23:09.810 [main] INFO o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Loading properties file from class path resource [default.model.properties]
14:23:09.810 [main] INFO o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Loading properties file from URL [file:/etc/app/app.properties]
14:23:09.810 [main] INFO o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Loading properties file from ServletContext resource [/${config}]
14:23:09.811 [main] WARN o.s.w.c.s.ServletContextPropertyPlaceholderConfigurer - Could not load properties from ServletContext resource [/${config}]: Could not open ServletContext resource [/${config}]
I'm not sure why tomcat isn't picking up the connection url and driver.
Is this a tomcat issue or am I missing something? Thanks
It's not a Tomcat issue, you must have made some minor mistake and properties are not loaded.
Are properties files located in proper place on your Tomcat environment?
Are you sure that in those properties files you have not left some keys blank?
If both answers to that questions are true, try changing your config with following:
<context:property-placeholder location="ADD_PATH_TO_YOUR_FILES SEPARATED_WITH_SPACES"/>
I guess that you are mixing here two property placeholders, one 'regular' and the other - bounded to servlet context. I can bet that somehow they get overlapped and one of them is getting silently ignored.
I would just stick to property-placeholder.
Old question, but...
Judging from the log output, it appears that Spring has not resolved your ${config} reference, or else this would have been substituted into the path given in the last log message:
Could not load properties from ServletContext resource [/${config}]: Could not open ServletContext resource [/${config}]
Here's a case I just encountered where it resolved ${catalina.home}/conf/myprops.properties correctly but was unable to load the referenced file:
Could not load properties from ServletContext resource [/D:/somepath/apache-tomcat/conf/myprops.properties]: Could not open ServletContext resource [/D:/somepath/apache-tomcat/conf/myprops.properties]
I tracked down the error in my case - I needed to prefix the external file reference with 'file:'. That is, it should have been file:${catalina.home}/conf/myprops.properties
(It is possible the Spring version difference may have impacted on the log output for you though also, and that it did resolve the reference but just did not show this in the output. For reference, I'm using Spring 4.1.6 at present).

Resources