I am trying to set up debug configurations in IntelliJ IDEA for AEM project. I am using 2016.3.3 version.
I did changed the correct port number in debug configuration and message the connected message. Example - 'Connected to the target VM, address: 'localhost:30303', transport: 'socket'.
Now when I am trying to debug my code: Run - Debug- Remote Debugger. I am getting this error.
Error running Remote Debugger: Unable to open debugger port (localhost:30303): java.net.ConnectException "Connection refused: connect"
Can anyone suggests whats wrong here.
Thanks in advance
Seems some other application(or may be the same config) is already connected to your env on this port. Supper easy way to fix this issue it is restart of AEM env(you don't need to figure out which app is using debug port).
You can also check your startup script which should be similar to:
java -Xmx3072m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=30303,suspend=n -jar aem-6.2.0.jar -nofork -p 4502
and IDEA config setup in the .idea/workspace.xml: inside of <component name="RunManager" tag configuration should be like:
<configuration default="false" name="30303" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="30303" />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="30303" />
<option name="LOCAL" value="false" />
</RunnerSettings>
<method />
</configuration>
Related
If I create step in Cucumber .feature file that is not implemented I get snippet in logs.
But if I make error in .feature file like starting new line with "Andd" or with anything but keywords (given, when..) then I get error in IntelliJ "Unexpected element" which is underlined and that's great.
But despite that when I build project I get "success build".
Also when I go further and run Cucumber tests I get
"0 Scenarios, 0 Steps found." and no explanation why.
Is there any build parameter that can be added to mark such build unsuccessful?
Is there any way to point to such errors?
Edit: when running from cmd 'mvn test..' I get nice stack trace.
Problem is only when running in Intellij > Run/Debug Configuration.
Sample .run.xml that I am using:
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Feature: testFeed" type="CucumberJavaRunConfigurationType" factoryName="Cucumber java" nameIsGenerated="true">
<option name="CUCUMBER_CORE_VERSION" value="5" />
<option name="FILE_PATH" value="$PROJECT_DIR$/src/test/resources/features/testFeed.feature" />
<option name="GLUE" value="com.testing.stepdefiniton" />
<option name="MAIN_CLASS_NAME" value="io.cucumber.core.cli.Main" />
<module name="testing" />
<option name="PROGRAM_PARAMETERS" value=" --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm5SMFormatter" />
<shortenClasspath name="NONE" />
<option name="SUGGESTED_NAME" value="Feature: testFeed" />
<option name="VM_PARAMETERS" value="-Dspring.profiles.active=local -Dcucumber.filter.tags="#test"" />
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="io.cucumber.core.cli.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
There are two parts to this question
You usage of IntelliJ (I can't help you with this)
Your usage of Cucumber (maybe I can help here)
Cucumber is telling you that it can't find any scenarios or any steps. Its not going to contribute until you can fix that. You need to either try running Cucumber from the command line, or configure IntelliJ correctly so it can find the features and steps when running cucumber.
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.
I'm using VS Code for Java development and working with other developers who use IntelliJ. I'd like to use the Organize Imports command (Shift+Alt+O) to clean up my imports, but I don't want to fight over import order with every commit. So I'd like to configure VS Code to organize the imports in the same order as IntelliJ's default. Does anybody have a configuration that would do this?
If this is not possible, is there a workspace configuration I can apply to both VS Code and IntelliJ so that the two IDEs will agree, even if they aren't agreeing on IntelliJ's default?
We were able to get it the almost identical with the following config tweaks.
VS Code:
{
"java.completion.importOrder": [
"",
"javax",
"java",
"#"
]
}
IntelliJ
The only difference from the IntelliJ default is a new line between import javax... and import java....
It's possible to get VS Code and IntelliJ to agree on a standard format, as long as that standard format:
Puts static imports at the top*
Separates all specific sections with empty lines
Puts everything not in its own specific section in a catch-all section at the end*
Never uses wildcard imports
Not actually true; static imports can be positioned in VS Code with '#', and everything else can be position in VS Code with ''.
IntelliJ's default settings don't work for this, but it is flexible enough to be reconfigured. Here are the files to add to a project to make just that project set up consistent rules for both IDEs (make sure they are not excluded in .gitignore).
Rule: The following groups separated by empty lines: Static imports, java.*, javax.*, everything else.
.vscode/settings.json:
{
"java.completion.importOrder": ["java", "javax"],
}
.idea/codeStyles/codeStyleConfig.xml:
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
.idea/codeStyles/Project.xml
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
</value>
</option>
</JavaCodeStyleSettings>
</code_scheme>
</component>
I'm trying a simple mybatis sample code on mac which connects a local postgresql server. I've testing the server connection with my own java jdbc test code, everything works find.
Then my Intellij mybatis maven project is configured with "resources/postgres.properties"
jdbc.driver="org.postgresql.Driver"
jdbc.url="jdbc:postgresql://localhost:5432/postgres"
jdbc.username="postgres"
jdbc.password="password"
This is a config that worked for my jdbc test code, and my "resources/mybatis.cfg.xml" is having:
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<dataSource type="POOLED">
<property name="driver" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql:/localhost:5432/postgres" />
<property name="username" value="postgres" />
<property name="password" value="password" />
</dataSource>
</environment>
</environments>
Then in my mybatis program, on calling mapper function it gives org.apache.ibatis.exceptions.PersistenceException:
Caused by: java.net.UnknownHostException: localhost
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.postgresql.core.PGStream.<init>(PGStream.java:70)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:91)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
... 25 more
I've searched for a while, all say it's because my /etc/hosts doesn't have localhost configuration. But in fact I have these 2 lines:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 localhost localhost.localdomain localhost6 localhost6.localdomain6
In my intellij environment, I've already done "Project structure->libraries->" to add my postgre driver into my project.
So it doesn't seem to be a localhost configuration problem. Where could be exception came from, how can I troubleshoot and solve it?
Thanks!
Postgres driver is added into the classpath (org.postgresql.core.PGStream class that appears in the stacktrace belongs to the postgres driver, so it's clearly there).
Now, it can be still a nework issue, as a first resort I suggest to check your program even without mybatis/postgres installation
Try to open a url connection to localhost and some port that is opened for sure) and see what happens right from the "main" method of your application.
You can also try using 127.0.0.1 instead of "localhost"
If you see that the localhost is not available, then it is for sure a configuration issue, otherwise other things possible as well.
From your description, it really sounds like a network/configuration issue but since its a "troubleshooting" question, I'm just trying to provide "troubleshooting" ideas...
Have a project that I am migrating over from netbeans to intellij.
Intellij recognises the spring config files and gives the warning "please configure/setup spring facet for modules". This requires manually adding these under project structure settings.
I don't want the other team members to all have to do this manually, so I wish to check these settings into git, but according to that, there are no changed files in the project directory (I have standard ignores added to .gitignore). I have also tried searches of file contents for the config file names etc and that turns up nothing too.
So my question is where are the settings stored? In a file that is typically on the ignored list or in a location external to the project directory?
Essentially all the IDEA related configuration for the project is under .idea folder, for example, all the project workspace iteams you can find in the .idea/worksapce.xml, include the spring features you mentioned.
But this is not a good idea to keep those things in your VCs, the .idea folder is ignore default as in the configuration items will store you local env related like the full path to your local gradle, e.g.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:/DevTools/gradle-2.14.1" />
<option name="gradleJvm" value="#JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="useAutoImport" value="true" />
<option name="myModules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
Here are some files under the .idea folder for my proejct
Update:
For the spring facets, it's under the module .iml file, like
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration>
<fileset id="fileset" name="Spring Application Context" removed="false">
<file>file://$MODULE_DIR$/src/main/resources/META-INF/spring/integration-beans.xml</file>
</fileset>
</configuration>
</facet>
</component>